Class: CukeModeler::Row
- Includes:
- Parsed, Parsing, 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 included from Parsing
Methods inherited from Model
Methods included from Containing
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.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cuke_modeler/models/row.rb', line 17 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
12 13 14 |
# File 'lib/cuke_modeler/models/row.rb', line 12 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.
30 31 32 33 34 |
# File 'lib/cuke_modeler/models/row.rb', line 30 def to_s text_cells = cells.collect { |cell| cell.to_s } "| #{text_cells.join(' | ')} |" end |