Class: Cucumber::Ast::Examples
- Includes:
- HasLocation, Names
- Defined in:
- lib/cucumber/ast/examples.rb
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.
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.
10 11 12 13 14 |
# File 'lib/cucumber/ast/examples.rb', line 10 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
#gherkin_statement(statement = nil) ⇒ Object (readonly)
Returns the value of attribute gherkin_statement.
16 17 18 |
# File 'lib/cucumber/ast/examples.rb', line 16 def gherkin_statement @gherkin_statement end |
#outline_table=(value) ⇒ Object (writeonly)
Sets the attribute outline_table
8 9 10 |
# File 'lib/cucumber/ast/examples.rb', line 8 def outline_table=(value) @outline_table = value end |
Instance Method Details
#accept(visitor) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/cucumber/ast/examples.rb', line 21 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
32 33 34 |
# File 'lib/cucumber/ast/examples.rb', line 32 def each_example_row(&proc) @outline_table.cells_rows[1..-1].each(&proc) end |
#failed? ⇒ Boolean
36 37 38 |
# File 'lib/cucumber/ast/examples.rb', line 36 def failed? @outline_table.cells_rows[1..-1].select{|row| row.failed?}.any? end |
#skip_invoke! ⇒ Object
28 29 30 |
# File 'lib/cucumber/ast/examples.rb', line 28 def skip_invoke! @outline_table.skip_invoke! end |
#to_sexp ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/cucumber/ast/examples.rb', line 40 def to_sexp sexp = [:examples, @keyword, name] comment = @comment.to_sexp sexp += [comment] if comment sexp += [@outline_table.to_sexp] sexp end |