Class: Cucumber::Ast::Examples
Overview
:nodoc:
Instance Attribute Summary collapse
-
#gherkin_statement(statement = nil) ⇒ Object
readonly
Returns the value of attribute gherkin_statement.
-
#outline_table ⇒ Object
writeonly
Sets the attribute outline_table.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #each_example_row(&proc) ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(comment, line, keyword, name, outline_table) ⇒ Examples
constructor
A new instance of Examples.
- #skip_invoke! ⇒ Object
- #to_sexp ⇒ Object
Constructor Details
#initialize(comment, line, keyword, name, outline_table) ⇒ Examples
Returns a new instance of Examples.
6 7 8 |
# File 'lib/cucumber/ast/examples.rb', line 6 def initialize(comment, line, keyword, name, outline_table) @comment, @keyword, @name, @outline_table = comment, keyword, name, outline_table end |
Instance Attribute Details
#gherkin_statement(statement = nil) ⇒ Object (readonly)
Returns the value of attribute gherkin_statement.
10 11 12 |
# File 'lib/cucumber/ast/examples.rb', line 10 def gherkin_statement @gherkin_statement end |
#outline_table=(value) ⇒ Object (writeonly)
Sets the attribute outline_table
4 5 6 |
# File 'lib/cucumber/ast/examples.rb', line 4 def outline_table=(value) @outline_table = value end |
Instance Method Details
#accept(visitor) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/cucumber/ast/examples.rb', line 15 def accept(visitor) return if Cucumber.wants_to_quit visitor.visit_comment(@comment) unless @comment.empty? visitor.visit_examples_name(@keyword, @name) visitor.visit_outline_table(@outline_table) end |
#each_example_row(&proc) ⇒ Object
26 27 28 |
# File 'lib/cucumber/ast/examples.rb', line 26 def each_example_row(&proc) @outline_table.cells_rows[1..-1].each(&proc) end |
#failed? ⇒ Boolean
30 31 32 |
# File 'lib/cucumber/ast/examples.rb', line 30 def failed? @outline_table.cells_rows[1..-1].select{|row| row.failed?}.any? end |
#skip_invoke! ⇒ Object
22 23 24 |
# File 'lib/cucumber/ast/examples.rb', line 22 def skip_invoke! @outline_table.skip_invoke! end |
#to_sexp ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/cucumber/ast/examples.rb', line 34 def to_sexp sexp = [:examples, @keyword, @name] comment = @comment.to_sexp sexp += [comment] if comment sexp += [@outline_table.to_sexp] sexp end |