Class: CukeModeler::Row
- Includes:
- Parsed, Sourceable
- Defined in:
- lib/cuke_modeler/models/row.rb
Overview
A class modeling a single row of a step table or example table.
Instance Attribute Summary collapse
-
#cells ⇒ Object
The cell models that make up the row.
Attributes included from Parsed
Attributes included from Sourceable
Attributes included from Nested
Instance Method Summary collapse
-
#initialize(source_text = nil) ⇒ Row
constructor
Creates a new Row object and, if source_text is provided, populates the object.
-
#to_s ⇒ Object
Returns a string representation of this model.
Methods inherited from Model
Methods included from Nested
Constructor Details
#initialize(source_text = nil) ⇒ Row
Creates a new Row object and, if source_text is provided, populates the object.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cuke_modeler/models/row.rb', line 16 def initialize(source_text = nil) @cells = [] super(source_text) if source_text parsed_row_data = parse_source(source_text) populate_row(self, parsed_row_data) end end |
Instance Attribute Details
#cells ⇒ Object
The cell models that make up the row
11 12 13 |
# File 'lib/cuke_modeler/models/row.rb', line 11 def cells @cells end |
Instance Method Details
#to_s ⇒ Object
Returns a string representation of this model. For a row model, this will be Gherkin text that is equivalent to the row being modeled.
29 30 31 32 33 |
# File 'lib/cuke_modeler/models/row.rb', line 29 def to_s text_cells = cells.collect { |cell| cell.to_s } "| #{text_cells.join(' | ')} |" end |