Class: DocRSpec::Parser
- Inherits:
-
Object
- Object
- DocRSpec::Parser
- Includes:
- Debugging
- Defined in:
- lib/doc_rspec/parser.rb
Defined Under Namespace
Classes: InternalError, SyntaxError
Constant Summary collapse
- COMMENT_LINE =
%r{\A \s* \#}x
- CONTEXT_DEFINITION =
%r{\A \s* \# \s ={1,7} \s (.*)}x
- EXAMPLE_LINE =
%r{\A \s* \# \s{4,} (.*)}x
- SHORT_EQUALS =
%r{\s \=\=\> \s}x
- SHORT_MATCHES =
%r{\s \~\> \s}x
- SHORT_PREDICATE =
%r{\s is\! \s}x
- SHORT_ANTIPREDICATE =
%r{\s not\! \s}x
- START_EXAMPLE =
%r{\A \s* \# \s{4,} \# \s example: \s (.*)}x
- SHORTCUTS =
[ [ SHORT_EQUALS, "to", "eq(%%%)" ], [ SHORT_MATCHES, "to", "match(%%%)" ], [ SHORT_PREDICATE, "to", "be_%%%" ], [ SHORT_ANTIPREDICATE, "not_to", "be_%%%" ], ]
Constants included from Debugging
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Returns the value of attribute ast.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
Methods included from Debugging
Instance Attribute Details
#ast ⇒ Object (readonly)
Returns the value of attribute ast.
30 31 32 |
# File 'lib/doc_rspec/parser.rb', line 30 def ast @ast end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
30 31 32 |
# File 'lib/doc_rspec/parser.rb', line 30 def lines @lines end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
30 31 32 |
# File 'lib/doc_rspec/parser.rb', line 30 def state @state end |
Instance Method Details
#parse ⇒ Object
32 33 34 35 36 37 |
# File 'lib/doc_rspec/parser.rb', line 32 def parse lines.each_with_index do |line, lnb| parse_line(line, lnb.succ) end ast.reject(&:empty?) end |