speculate_about 1.0.1 → 1.0.3

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: 9b33715812d0321ea53813b6a821e91c355f235c088a4ac6410f338e681d4a2b
4
- data.tar.gz: 2e8cc718817fba9f4aa263f65420de5aa4f70625f7e1c8b7c0b43b352ac69e7e
3
+ metadata.gz: 96e9eda6deb236573c353c92c89f44760d2999cba3125bf1e8649d65a4bc1b2f
4
+ data.tar.gz: 332f43cee63d821d30fab5a6d55bdfb3e8f262c572ece94a5fedb32df76da35f
5
5
  SHA512:
6
- metadata.gz: 42b7a04f119f34a49bd694509807681f7ebd8d4348556e1a121e648c391447a8f6f28cde03fc7615b93b07e077b6c5d268ef590c437e9c233d18a639b76db622
7
- data.tar.gz: a5980e1500f466cb7072d55deb5b56fa5b790dc24810e902e28f3e105c053e8d0ab447403ef367ee51a9318151a06e80ede034e4b5f1a21ca62cf39c32c78d3c
6
+ metadata.gz: f94c4c30a750cc567462a3d07a54ffdadc96a2ab25ad7455841aca001e9d48d84b79a45d0c3aa814b3c2d43773c974d941cb54ffaf211963c9b7d91860529d69
7
+ data.tar.gz: 28989add83923ef511532015ea95cddd91730e874a6fcd30381e3a8138841d4f8bb7b6fa35fe8dfde46495243e4e840f160a2678d910564700572e40af9b0d18
@@ -25,3 +25,4 @@ end
25
25
  RSpec.configure do |conf|
26
26
  conf.extend SpeculateAbout
27
27
  end
28
+ # SPDX-License-Identifier: Apache-2.0
@@ -7,26 +7,39 @@ module Speculations
7
7
  when State.blank_line(line)
8
8
  [:candidate, node, ctxt]
9
9
  when match = State.context_match(line)
10
- level = match[1].size
11
- new_parent = node.parent_of_level(level.pred)
12
- node = new_parent.new_context(title: match[2], lnb: lnb, level: level)
13
- [:out, node]
10
+ _parse_context(match, lnb:, node:)
14
11
  when match = State.maybe_include(line)
15
12
  [:candidate, node, :inc]
16
13
  when match = State.maybe_example(line)
17
14
  [:candidate, node, match[:title]]
18
15
  when match = State.ruby_code_block(line)
16
+ _parse_ruby_code_block(match, ctxt:, lnb:, node:)
17
+ else
18
+ [:out, node]
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def _parse_context(match, lnb:, node:)
25
+ level = match[1].size
26
+ new_parent = node.parent_of_level(level.pred)
27
+ node = new_parent.new_context(title: match[2], lnb: lnb, level: level)
28
+ [:out, node]
29
+ end
30
+
31
+ def _parse_ruby_code_block(match, ctxt:, lnb:, node:)
19
32
  if ctxt == :inc
20
33
  node = node.new_include(lnb: lnb)
21
34
  else
22
35
  node = node.new_example(title: ctxt, lnb: lnb)
23
36
  end
24
37
  [:in, node, (ctxt == :inc ? :includes : :out)]
25
- else
26
- [:out, node]
27
- end
28
38
  end
39
+
40
+
29
41
  end
30
42
  end
31
43
  end
32
44
  end
45
+ # SPDX-License-Identifier: Apache-2.0
@@ -1,3 +1,3 @@
1
1
  module Speculations
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.3"
3
3
  end
data/lib/speculations.rb CHANGED
@@ -7,7 +7,7 @@ module Speculations extend self
7
7
  # This file was generated from FILENAME with the speculate_about gem, if you modify this file
8
8
  # one of two bad things will happen
9
9
  # - your documentation specs are not correct
10
- # - your modifications will be overwritten by the speculate rake task
10
+ # - your modifications will be overwritten by the speculate command line
11
11
  # YOU HAVE BEEN WARNED
12
12
  EOD
13
13
 
@@ -15,7 +15,7 @@ module Speculations extend self
15
15
  raise ArgumentError, "#{infile} not found" unless File.readable? infile
16
16
  outfile ||= _speculation_path(infile)
17
17
  if _out_of_date?(outfile, infile)
18
- ast = p Speculations::Parser.new.parse_from_file(infile)
18
+ ast = Speculations::Parser.new.parse_from_file(infile)
19
19
  code = _decorated_ast_code ast, infile
20
20
  File.write(outfile, code.join("\n"))
21
21
  end
@@ -30,7 +30,7 @@ module Speculations extend self
30
30
  end
31
31
 
32
32
  def _out_of_date?(outf, inf)
33
- return true unless File.exists? outf
33
+ return true unless File.exist? outf
34
34
  return File.lstat(outf).mtime <= File.lstat(inf).mtime
35
35
  end
36
36
 
@@ -42,3 +42,4 @@ module Speculations extend self
42
42
  File.join(dest_dir, "#{rspec}_spec.rb")
43
43
  end
44
44
  end
45
+ # SPDX-License-Identifier: Apache-2.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speculate_about
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-06 00:00:00.000000000 Z
11
+ date: 2023-08-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Allows Markdown or other text files to be used as literal specs, à la
14
14
  Elixr doctest, but from any file.
@@ -38,7 +38,7 @@ homepage: https://github.com/robertdober/speculate
38
38
  licenses:
39
39
  - Apache-2.0
40
40
  metadata: {}
41
- post_install_message:
41
+ post_install_message:
42
42
  rdoc_options: []
43
43
  require_paths:
44
44
  - lib
@@ -53,8 +53,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  requirements: []
56
- rubygems_version: 3.3.3
57
- signing_key:
56
+ rubygems_version: 3.4.19
57
+ signing_key:
58
58
  specification_version: 4
59
59
  summary: Extract RSpecs from Markdown
60
60
  test_files: []