Class: CukeModeler::Table
- Includes:
- Parsed, Parsing, Sourceable
- Defined in:
- lib/cuke_modeler/models/table.rb
Overview
A class modeling a step’s table.
Instance Attribute Summary collapse
-
#rows ⇒ Object
The row models that make up the table.
Attributes included from Sourceable
Attributes included from Parsed
Attributes included from Nested
Instance Method Summary collapse
-
#children ⇒ Object
Returns the model objects that belong to this model.
-
#initialize(source_text = nil) ⇒ Table
constructor
Creates a new Table object and, if source_text is provided, populates the object.
-
#to_s ⇒ Object
Returns a string representation of this model.
Methods included from Parsing
Methods included from Containing
Methods included from Nested
Constructor Details
#initialize(source_text = nil) ⇒ Table
Creates a new Table object and, if source_text is provided, populates the object.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cuke_modeler/models/table.rb', line 18 def initialize(source_text = nil) @rows = [] super(source_text) if source_text parsed_table_data = parse_source(source_text) populate_table(self, parsed_table_data) end end |
Instance Attribute Details
#rows ⇒ Object
The row models that make up the table
13 14 15 |
# File 'lib/cuke_modeler/models/table.rb', line 13 def rows @rows end |
Instance Method Details
#children ⇒ Object
Returns the model objects that belong to this model.
30 31 32 |
# File 'lib/cuke_modeler/models/table.rb', line 30 def children rows end |
#to_s ⇒ Object
Returns a string representation of this model. For a table model, this will be Gherkin text that is equivalent to the table being modeled.
36 37 38 |
# File 'lib/cuke_modeler/models/table.rb', line 36 def to_s rows.empty? ? '' : rows.collect { |row| row_output_string(row) }.join("\n") end |