Module: Speculations::Parser::State

Extended by:
State
Included in:
State
Defined in:
lib/speculations/parser/state.rb,
lib/speculations/parser/state/bef.rb,
lib/speculations/parser/state/exa.rb,
lib/speculations/parser/state/inc.rb,
lib/speculations/parser/state/out.rb

Defined Under Namespace

Modules: Bef, Exa, Inc, Out

Constant Summary collapse

BEFORE_RGX =
%r[\A\s{0,3}```.*\s:before]
CONTEXT_RGX =
%r[\A\s{0,3}\#{1,7}\s+Context\s+(.*)]
EOBLOCK_RGX =
%r[\A\s{0,3}```\s*\z]
EXAMPLE_RGX =
%r[\A\s{0,3}```.*\s:example]
INCLUDE_RGX =
%r[\A\s{0,3}```.*\s:include]
NAME_RGX =
%r[\A\s{0,3}Example:\s+(.*)]

Instance Method Summary collapse

Instance Method Details

#before_match(line) ⇒ Object



14
15
16
# File 'lib/speculations/parser/state.rb', line 14

def before_match line
  BEFORE_RGX =~ line
end

#context_match(line) ⇒ Object



18
19
20
21
22
# File 'lib/speculations/parser/state.rb', line 18

def context_match line
  if match = CONTEXT_RGX.match(line)
    match.captures.first
  end
end

#eoblock_match(line) ⇒ Object



24
25
26
# File 'lib/speculations/parser/state.rb', line 24

def eoblock_match line
  EOBLOCK_RGX =~ line
end

#example_match(line) ⇒ Object



28
29
30
# File 'lib/speculations/parser/state.rb', line 28

def example_match line
  EXAMPLE_RGX =~ line
end

#include_match(line) ⇒ Object



32
33
34
# File 'lib/speculations/parser/state.rb', line 32

def include_match line
  INCLUDE_RGX =~ line
end

#potential_name(line) ⇒ Object



36
37
38
# File 'lib/speculations/parser/state.rb', line 36

def potential_name line
  NAME_RGX.match(line)
end