Class: CukeModeler::DocString
- Includes:
- Parsed, Sourceable
- Defined in:
- lib/cuke_modeler/models/doc_string.rb
Overview
A class modeling a step’s doc string.
Instance Attribute Summary collapse
-
#content ⇒ Object
The content of the doc string.
-
#content_type ⇒ Object
The content type associated with the doc string.
Attributes included from Sourceable
Attributes included from Parsed
Attributes included from Nested
Instance Method Summary collapse
-
#initialize(source_text = nil) ⇒ DocString
constructor
Creates a new DocString 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) ⇒ DocString
Creates a new DocString object and, if source_text is provided, populates the object.
20 21 22 23 24 25 26 27 |
# File 'lib/cuke_modeler/models/doc_string.rb', line 20 def initialize(source_text = nil) super(source_text) if source_text parsed_doc_string_data = parse_source(source_text) populate_docstring(self, parsed_doc_string_data) end end |
Instance Attribute Details
#content ⇒ Object
The content of the doc string
15 16 17 |
# File 'lib/cuke_modeler/models/doc_string.rb', line 15 def content @content end |
#content_type ⇒ Object
The content type associated with the doc string
12 13 14 |
# File 'lib/cuke_modeler/models/doc_string.rb', line 12 def content_type @content_type end |
Instance Method Details
#to_s ⇒ Object
Returns a string representation of this model. For a doc string model, this will be Gherkin text that is equivalent to the doc string being modeled.
31 32 33 34 35 |
# File 'lib/cuke_modeler/models/doc_string.rb', line 31 def to_s text = "\"\"\"#{content_type_output_string}\n" text << content_output_string text << '"""' end |