Class: CukeModeler::Cell
- Includes:
- Parsed, Parsing, Sourceable
- Defined in:
- lib/cuke_modeler/models/cell.rb
Overview
A class modeling a single cell of a row.
Instance Attribute Summary collapse
-
#value ⇒ Object
The value of the cell.
Attributes included from Parsed
Attributes included from Sourceable
Attributes included from Nested
Instance Method Summary collapse
-
#initialize(source_text = nil) ⇒ Cell
constructor
Creates a new Cell 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 Nested
Constructor Details
#initialize(source_text = nil) ⇒ Cell
Creates a new Cell object and, if source_text is provided, populates the object.
18 19 20 21 22 23 24 25 |
# File 'lib/cuke_modeler/models/cell.rb', line 18 def initialize(source_text = nil) super(source_text) if source_text parsed_cell_data = parse_source(source_text) populate_cell(self, parsed_cell_data) end end |
Instance Attribute Details
#value ⇒ Object
The value of the cell
13 14 15 |
# File 'lib/cuke_modeler/models/cell.rb', line 13 def value @value end |
Instance Method Details
#to_s ⇒ Object
Returns a string representation of this model. For a cell model, this will be Gherkin text that is equivalent to the cell being modeled.
29 30 31 32 |
# File 'lib/cuke_modeler/models/cell.rb', line 29 def to_s # Vertical bars and backslashes are special characters that need to be escaped @value ? @value.gsub('\\', '\\\\\\').gsub('|', '\|') : '' end |