Class: DocRSpec::Ast
- Inherits:
-
Object
- Object
- DocRSpec::Ast
- Defined in:
- lib/doc_rspec/ast.rb,
lib/doc_rspec/ast/example.rb
Defined Under Namespace
Classes: Example
Instance Attribute Summary collapse
-
#examples ⇒ Object
readonly
Returns the value of attribute examples.
-
#lnb ⇒ Object
readonly
Returns the value of attribute lnb.
Instance Method Summary collapse
- #add_example(lnb, match) ⇒ Object
- #add_example_line(op, lhs, rhs = nil) ⇒ Object
- #close_example(&error_handler) ⇒ Object
- #context_name(path) ⇒ Object
Instance Attribute Details
#examples ⇒ Object (readonly)
Returns the value of attribute examples.
6 7 8 |
# File 'lib/doc_rspec/ast.rb', line 6 def examples @examples end |
#lnb ⇒ Object (readonly)
Returns the value of attribute lnb.
6 7 8 |
# File 'lib/doc_rspec/ast.rb', line 6 def lnb @lnb end |
Instance Method Details
#add_example(lnb, match) ⇒ Object
8 9 10 |
# File 'lib/doc_rspec/ast.rb', line 8 def add_example(lnb, match) examples << Example.new(lnb, match) end |
#add_example_line(op, lhs, rhs = nil) ⇒ Object
12 13 14 |
# File 'lib/doc_rspec/ast.rb', line 12 def add_example_line(op, lhs, rhs=nil) examples.last.add(op, lhs, rhs) end |
#close_example(&error_handler) ⇒ Object
16 17 18 19 20 |
# File 'lib/doc_rspec/ast.rb', line 16 def close_example(&error_handler) return unless examples.last.lines.empty? error_handler.() end |
#context_name(path) ⇒ Object
22 23 24 |
# File 'lib/doc_rspec/ast.rb', line 22 def context_name(path) "docspec #{path}:#{lnb}" end |