Module: Speculations::Parser::State::Triggers
- Included in:
- Speculations::Parser::State
- Defined in:
- lib/speculations/parser/state/triggers.rb
Constant Summary collapse
- BLANK_RGX =
%r{\A\s*\z}- CONTEXT_RGX =
%r[\A\s{0,3}(?<level>\#{1,7})\s+Context:?\s+(?<title>.*)]- EOBLOCK_RGX =
%r[\A\s{0,3}```\s*\z]- GIVEN_RGX =
%r[\A\s{0,3}(?:Given|When|And)\b]- EXAMPLE_RGX =
%r[\A\s{0,3}Example\:?\s+(?<title>.*)]- RUBY_RGX =
%r[\A\s{0,3}```ruby]- THEN_RGX =
%r[\A\s{0,3}(?:Then|But|And|Also|Or|However|Furhermore)\b\s*(?<title>.*)]
Instance Method Summary collapse
- #blank_line(line) ⇒ Object
- #context_match(line) ⇒ Object
- #eoblock_match(line) ⇒ Object
- #maybe_example(line) ⇒ Object
- #maybe_include(line) ⇒ Object
- #ruby_code_block(line) ⇒ Object
Instance Method Details
#blank_line(line) ⇒ Object
11 12 13 |
# File 'lib/speculations/parser/state/triggers.rb', line 11 def blank_line line BLANK_RGX.match(line) end |
#context_match(line) ⇒ Object
15 16 17 |
# File 'lib/speculations/parser/state/triggers.rb', line 15 def context_match line CONTEXT_RGX.match(line) end |
#eoblock_match(line) ⇒ Object
19 20 21 |
# File 'lib/speculations/parser/state/triggers.rb', line 19 def eoblock_match line EOBLOCK_RGX.match(line) end |
#maybe_example(line) ⇒ Object
23 24 25 26 |
# File 'lib/speculations/parser/state/triggers.rb', line 23 def maybe_example line EXAMPLE_RGX.match(line) || THEN_RGX.match(line) end |
#maybe_include(line) ⇒ Object
28 29 30 |
# File 'lib/speculations/parser/state/triggers.rb', line 28 def maybe_include line GIVEN_RGX.match(line) end |
#ruby_code_block(line) ⇒ Object
32 33 34 |
# File 'lib/speculations/parser/state/triggers.rb', line 32 def ruby_code_block line RUBY_RGX.match(line) end |