speculate_about 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 418165840fa00627dbf34678bfc9eec5133565b4d9eaf697a8a748242b8fe759
4
- data.tar.gz: 4a1cbab184f1b6861ef38112750e4783b257a19d61dbf19ae4a4385aed47fcde
3
+ metadata.gz: 96e9eda6deb236573c353c92c89f44760d2999cba3125bf1e8649d65a4bc1b2f
4
+ data.tar.gz: 332f43cee63d821d30fab5a6d55bdfb3e8f262c572ece94a5fedb32df76da35f
5
5
  SHA512:
6
- metadata.gz: 251c5d8c14c559797d1246aac8e1ba9cc269be9e68cbe496808768989ffaaf99d0fa2c60d4571ead528cecb7104a7ecee4335119bd28244a9f9678e906855bc1
7
- data.tar.gz: 070a7aaa0842f8627876be6516bed4a9cf3615d738bda0d58f0414df4f6b72d5b49302e607960d33dcf524589a4304e3fa31ce30eef5968dfce94e496301e53c
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.2"
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
 
@@ -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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
8
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.
@@ -53,7 +53,7 @@ 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
56
+ rubygems_version: 3.4.19
57
57
  signing_key:
58
58
  specification_version: 4
59
59
  summary: Extract RSpecs from Markdown