Class: Lucid::AST::Examples
- Includes:
- HasLocation, Names
- Defined in:
- lib/lucid/ast/examples.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#gherkin_statement(statement = nil) ⇒ Object
readonly
Returns the value of attribute gherkin_statement.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#outline_table ⇒ Object
Returns the value of attribute outline_table.
Attributes included from Names
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #each_example_row(&proc) ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(location, comment, keyword, title, description, outline_table) ⇒ Examples
constructor
A new instance of Examples.
- #skip_invoke! ⇒ Object
- #to_sexp ⇒ Object
Methods included from HasLocation
#file, #file_colon_line, #line, #location
Methods included from Names
Constructor Details
#initialize(location, comment, keyword, title, description, outline_table) ⇒ Examples
Returns a new instance of Examples.
11 12 13 14 15 |
# File 'lib/lucid/ast/examples.rb', line 11 def initialize(location, comment, keyword, title, description, outline_table) @location, @comment, @keyword, @title, @description, @outline_table = location, comment, keyword, title, description, outline_table raise ArgumentError unless @location.is_a?(Location) raise ArgumentError unless @comment.is_a?(Comment) end |
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
9 10 11 |
# File 'lib/lucid/ast/examples.rb', line 9 def comment @comment end |
#gherkin_statement(statement = nil) ⇒ Object (readonly)
Returns the value of attribute gherkin_statement.
17 18 19 |
# File 'lib/lucid/ast/examples.rb', line 17 def gherkin_statement @gherkin_statement end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
9 10 11 |
# File 'lib/lucid/ast/examples.rb', line 9 def keyword @keyword end |
#outline_table ⇒ Object
Returns the value of attribute outline_table.
9 10 11 |
# File 'lib/lucid/ast/examples.rb', line 9 def outline_table @outline_table end |
Instance Method Details
#accept(visitor) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/lucid/ast/examples.rb', line 22 def accept(visitor) visitor.visit_examples(self) do comment.accept(visitor) visitor.visit_examples_name(keyword, name) outline_table.accept(visitor) end end |
#each_example_row(&proc) ⇒ Object
34 35 36 |
# File 'lib/lucid/ast/examples.rb', line 34 def each_example_row(&proc) @outline_table.cells_rows[1..-1].each(&proc) end |
#failed? ⇒ Boolean
38 39 40 |
# File 'lib/lucid/ast/examples.rb', line 38 def failed? @outline_table.cells_rows[1..-1].select{|row| row.failed?}.any? end |
#skip_invoke! ⇒ Object
30 31 32 |
# File 'lib/lucid/ast/examples.rb', line 30 def skip_invoke! @outline_table.skip_invoke! end |
#to_sexp ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/lucid/ast/examples.rb', line 42 def to_sexp sexp = [:examples, @keyword, name] comment = comment.to_sexp sexp += [comment] if comment sexp += [@outline_table.to_sexp] sexp end |