class CukeModeler::Row
A class modeling a single row of a step table or example table.
Attributes
cells[RW]
The cell models that make up the row
Public Class Methods
new(source_text = nil)
click to toggle source
Creates a new Row
object and, if source_text is provided, populates the object.
Calls superclass method
CukeModeler::Model::new
# File lib/cuke_modeler/models/row.rb, line 16 def initialize(source_text = nil) @cells = [] super(source_text) return unless source_text parsed_row_data = parse_source(source_text) populate_row(self, parsed_row_data) end
Public Instance Methods
children()
click to toggle source
Returns the model objects that belong to this model.
# File lib/cuke_modeler/models/row.rb, line 28 def children @cells end
to_s()
click to toggle source
Returns a string representation of this model. For a row model, this will be Gherkin text that is equivalent to the row being modeled.
# File lib/cuke_modeler/models/row.rb, line 34 def to_s text_cells = cells.map(&:to_s) "| #{text_cells.join(' | ')} |" end
Private Instance Methods
parse_source(source_text)
click to toggle source
# File lib/cuke_modeler/models/row.rb, line 44 def parse_source(source_text) base_file_string = "# language: #{Parsing.dialect} #{dialect_feature_keyword}: Fake feature to parse #{dialect_scenario_keyword}: #{dialect_step_keyword} fake step\n" source_text = base_file_string + source_text parsed_file = Parsing.parse_text(source_text, 'cuke_modeler_stand_alone_row.feature') parsed_file['feature']['elements'].first['steps'].first['table']['rows'].first end