speculate_about 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e318f99308bc176c98e6bbf5c5367b626123058b6fc356928a60946ff338d574
4
- data.tar.gz: 3f659caecff4fc5721aff5e113f5bef38d3b405a7661848a550cd2f84810cb54
3
+ metadata.gz: 55214fa13796f901f6a8d1bc3383d98665bc0108892c6ffb349a6cab179e89fb
4
+ data.tar.gz: 70507372a7ea0cddab9d655385aeaeecb0103ec8837c7149d5819adb4289f6af
5
5
  SHA512:
6
- metadata.gz: a1ef2fc905252a43b7c585042d9028609fd1a62ce4c0cf3b6ad7f570550e220d800717cc8895744ccbb0de93193c084801e634f23ecb4a03b20512a98f691524
7
- data.tar.gz: 52c2f1123864067ce0b5ce5a44196a453c9ac306c24d394ffe4f6efc58cbd80a53e25f6d83ebabb6e9bd6ad4a3315e1b65ba08b55418354c92bb4098564672dd
6
+ metadata.gz: a31db003b1002096eac96dc811766609d2aae64646830815f874e3ed516d616f702803d7b7363464a12971b75ee64b2c17a79d914b1a02ac6eec317c0d7ec174
7
+ data.tar.gz: f2cf3a4279e8777b3e9a5df3cdd6ce2b6887636d044ea2f132683f099a14ca9aa23867ea5c214f5cf024f2f718303484f23103de6a71174b7a5958342ce8d3f3
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Speculations
4
4
  class Data
5
- attr_reader :ctxt, :debug, :line, :lnb, :node, :state
5
+ attr_reader :ctxt, :debug, :filename, :line, :lnb, :node, :state
6
6
 
7
7
  def info(label) = node.info(label)
8
8
 
@@ -19,9 +19,10 @@ module Speculations
19
19
  end
20
20
 
21
21
  private
22
- def initialize(line:, lnb:, state:, node:, ctxt: nil, debug: false)
22
+ def initialize(line:, lnb:, state:, node:, filename: nil, ctxt: nil, debug: false)
23
23
  @ctxt = ctxt
24
24
  @debug = debug
25
+ @filename = filename
25
26
  @line = line
26
27
  @lnb = lnb
27
28
  @node = node
@@ -13,6 +13,7 @@ module Speculations
13
13
 
14
14
  def make_spec_context(data, title:)
15
15
  level = data.node.level.succ
16
+ title << " (#{data.filename}:#{data.lnb})"
16
17
  node = data.node.new_context(title:, lnb: data.lnb, level:)
17
18
  data.update(state: :examples, node:)
18
19
  end
@@ -5,13 +5,15 @@ module Speculations
5
5
  module Includes extend self
6
6
  include ContextMaker
7
7
 
8
- # def parse line, lnb, node, _ctxt, debug: true
9
8
  def parse(data)
10
9
  line = data.line
11
10
  case
12
11
  when match = State.context_match(line)
13
12
  #dbg_match("context", data)
14
13
  make_new_context(data, match: match)
14
+ when match = State.spec_context_line(line)
15
+ #dbg_match("specify context", data)
16
+ make_spec_context(data, title: data.line.strip)
15
17
  when match = State.maybe_include(line)
16
18
  #dbg_match("maybe_include", data)
17
19
  data.update(state: :candidate, ctxt: :inc)
@@ -4,7 +4,6 @@ module Speculations::Parser::State extend self
4
4
  require_relative './state/in'
5
5
  require_relative './state/includes'
6
6
  require_relative './state/out'
7
- require_relative './state/spec_context'
8
7
  require_relative './state/specify_block'
9
8
  require_relative './state/triggers'
10
9
 
@@ -13,7 +13,6 @@ module Speculations
13
13
  in: State::In,
14
14
  includes: State::Includes,
15
15
  out: State::Out,
16
- spec_context: State::SpecContext,
17
16
  specify_block: State::SpecifyBlock
18
17
  }
19
18
  end
@@ -31,13 +30,13 @@ module Speculations
31
30
 
32
31
  def parse!(debug:)
33
32
  root = node = Context.new(filename: @filename)
34
- data = Data.new(node:, lnb: 0, line: nil, state: :out, debug:)
33
+ data = Data.new(node:, lnb: 0, line: nil, filename: @filename, state: :out, debug:)
35
34
  @input.each_with_index do |line, lnb|
36
35
  data.update(line:, lnb:)
37
36
  parser = self.class.parsers.fetch(data.state)
38
37
  old_state = data.state
39
38
  data = parser.parse(data)
40
- # debug_state(old_state:, data:)
39
+ debug_state(old_state:, data:)
41
40
  end
42
41
  root
43
42
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Speculations
4
- VERSION = "1.3.0"
4
+ VERSION = "1.3.1"
5
5
  end
6
6
  # SPDX-License-Identifier: AGPL-3.0-or-later
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speculate_about
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-04-25 00:00:00.000000000 Z
10
+ date: 2026-04-26 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: Allows Markdown or other text files to be used as literal specs, à la
13
13
  Elixir doctest, but from any file.
@@ -35,7 +35,6 @@ files:
35
35
  - lib/speculations/parser/state/in.rb
36
36
  - lib/speculations/parser/state/includes.rb
37
37
  - lib/speculations/parser/state/out.rb
38
- - lib/speculations/parser/state/spec_context.rb
39
38
  - lib/speculations/parser/state/specify_block.rb
40
39
  - lib/speculations/parser/state/triggers.rb
41
40
  - lib/speculations/version.rb
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Speculations
4
- class Parser
5
- module State
6
- module SpecContext extend self
7
- extend ContextMaker
8
-
9
- def parse line, lnb, node, title, debug: false
10
- # node.info(:spec_context)
11
- if State.ruby_code_block(line)
12
- #dbg_match("examples", lnb, debug:)
13
- make_spec_context(lnb:, node:, title:)
14
- else
15
- #dbg_match("abandon spec context", lnb, debug:)
16
- [:out, node]
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
23
- # SPDX-License-Identifier: AGPL-3.0-or-later