speculate_about 1.0.0 → 1.0.1

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: 691aa57b9ad1035ca6eb20fe75f89b818414dcd33e05acd9d6621e13ee1cfb23
4
- data.tar.gz: 286766d1c5243bc9c1c6eb205c6e38ee97b3d06c90f4d77b6d84638a56d465e2
3
+ metadata.gz: 9b33715812d0321ea53813b6a821e91c355f235c088a4ac6410f338e681d4a2b
4
+ data.tar.gz: 2e8cc718817fba9f4aa263f65420de5aa4f70625f7e1c8b7c0b43b352ac69e7e
5
5
  SHA512:
6
- metadata.gz: cea1cc7dc006a7315fac53026959d444ae5a9bdcad161a94f57df7fdf3bead8cf5ee23aac5b9eaecdd68bc888cbf0df9e290acc4e09435f2b5bd771113ce38c3
7
- data.tar.gz: 6dcd950c3ea0bace47c8ecf3e42dd38ff41d747ac92918c30c08e2403e0c6c2471dcf69c1f3eddc04049988c40d555b07f470ee6a3e873cf8c36aa1223828690
6
+ metadata.gz: 42b7a04f119f34a49bd694509807681f7ebd8d4348556e1a121e648c391447a8f6f28cde03fc7615b93b07e077b6c5d268ef590c437e9c233d18a639b76db622
7
+ data.tar.gz: a5980e1500f466cb7072d55deb5b56fa5b790dc24810e902e28f3e105c053e8d0ab447403ef367ee51a9318151a06e80ede034e4b5f1a21ca62cf39c32c78d3c
@@ -2,7 +2,7 @@ class Speculations::Parser::Context::Include
2
2
 
3
3
  attr_reader :lnb, :parent
4
4
 
5
- def add_line line
5
+ def add_line line
6
6
  lines << line
7
7
  self
8
8
  end
@@ -45,7 +45,7 @@ module Speculations
45
45
 
46
46
  def map_lines(*lines, indent: 0)
47
47
  prefix = " " * (tree_level + indent).succ
48
- lines.flatten.map{ |line| "#{prefix}#{line.strip}" }
48
+ lines.flatten.map{ |line| "#{prefix}#{line.strip}".rstrip }
49
49
  end
50
50
 
51
51
  def to_code
@@ -0,0 +1,16 @@
1
+ module Speculations
2
+ class Parser
3
+ module State
4
+ module ContextMaker
5
+ private
6
+
7
+ def make_new_context(lnb:, match:, node:)
8
+ level = match[:level].size
9
+ new_parent = node.parent_of_level(level.pred)
10
+ node = new_parent.new_context(title: match[:title], lnb: lnb, level: level)
11
+ [:out, node]
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,7 +1,9 @@
1
+ require_relative 'context_maker'
1
2
  module Speculations
2
3
  class Parser
3
4
  module State
4
5
  module Includes extend self
6
+ include ContextMaker
5
7
 
6
8
  def parse line, lnb, node, _ctxt
7
9
  case
@@ -16,15 +18,6 @@ module Speculations
16
18
  end
17
19
  end
18
20
 
19
- private
20
-
21
- def make_new_context(lnb:, match:, node:)
22
- level = match[:level].size
23
- new_parent = node.parent_of_level(level.pred)
24
- node = new_parent.new_context(title: match[:title], lnb: lnb, level: level)
25
- [:out, node]
26
- end
27
-
28
21
  end
29
22
  end
30
23
  end
@@ -1,7 +1,9 @@
1
+ require_relative 'context_maker'
1
2
  module Speculations
2
3
  class Parser
3
4
  module State
4
5
  module Out extend self
6
+ include ContextMaker
5
7
 
6
8
  def parse line, lnb, node, _ctxt
7
9
  case
@@ -16,15 +18,6 @@ module Speculations
16
18
  end
17
19
  end
18
20
 
19
- private
20
-
21
- def make_new_context(lnb:, match:, node:)
22
- level = match[:level].size
23
- new_parent = node.parent_of_level(level.pred)
24
- node = new_parent.new_context(title: match[:title], lnb: lnb, level: level)
25
- [:out, node]
26
- end
27
-
28
21
  end
29
22
  end
30
23
  end
@@ -1,3 +1,3 @@
1
1
  module Speculations
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/speculations.rb CHANGED
@@ -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 = Speculations::Parser.new.parse_from_file(infile)
18
+ ast = p 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
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.0
4
+ version: 1.0.1
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-01-30 00:00:00.000000000 Z
11
+ date: 2022-02-06 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.
@@ -28,6 +28,7 @@ files:
28
28
  - lib/speculations/parser/context/include.rb
29
29
  - lib/speculations/parser/state.rb
30
30
  - lib/speculations/parser/state/candidate.rb
31
+ - lib/speculations/parser/state/context_maker.rb
31
32
  - lib/speculations/parser/state/in.rb
32
33
  - lib/speculations/parser/state/includes.rb
33
34
  - lib/speculations/parser/state/out.rb
@@ -37,7 +38,7 @@ homepage: https://github.com/robertdober/speculate
37
38
  licenses:
38
39
  - Apache-2.0
39
40
  metadata: {}
40
- post_install_message:
41
+ post_install_message:
41
42
  rdoc_options: []
42
43
  require_paths:
43
44
  - lib
@@ -53,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  version: '0'
54
55
  requirements: []
55
56
  rubygems_version: 3.3.3
56
- signing_key:
57
+ signing_key:
57
58
  specification_version: 4
58
59
  summary: Extract RSpecs from Markdown
59
60
  test_files: []