Class: CucumberAnalytics::DocString
- Inherits:
-
Object
- Object
- CucumberAnalytics::DocString
- Defined in:
- lib/cucumber_analytics/doc_string.rb
Overview
A class modeling the Doc String of a Step.
Instance Attribute Summary collapse
-
#content_type ⇒ Object
The content type associated with the doc string.
-
#contents ⇒ Object
Deprecated.
-
#contents_text ⇒ Object
The contents of the doc string.
Attributes included from Nested
Attributes included from Raw
Instance Method Summary collapse
-
#initialize(source = nil) ⇒ DocString
constructor
Creates a new DocString object and, if source is provided, populates the object.
-
#to_s ⇒ Object
Returns a gherkin representation of the doc string.
Methods included from Nested
Constructor Details
#initialize(source = nil) ⇒ DocString
Creates a new DocString object and, if source is provided, populates the object.
25 26 27 28 29 30 31 32 |
# File 'lib/cucumber_analytics/doc_string.rb', line 25 def initialize(source = nil) @contents = [] @contents_text = '' parsed_doc_string = process_source(source) build_doc_string(parsed_doc_string) if parsed_doc_string end |
Instance Attribute Details
#content_type ⇒ Object
The content type associated with the doc string
12 13 14 |
# File 'lib/cucumber_analytics/doc_string.rb', line 12 def content_type @content_type end |
#contents ⇒ Object
Deprecated
The contents of the doc string
17 18 19 |
# File 'lib/cucumber_analytics/doc_string.rb', line 17 def contents @contents end |
#contents_text ⇒ Object
The contents of the doc string
20 21 22 |
# File 'lib/cucumber_analytics/doc_string.rb', line 20 def contents_text @contents_text end |
Instance Method Details
#to_s ⇒ Object
Returns a gherkin representation of the doc string.
35 36 37 38 39 |
# File 'lib/cucumber_analytics/doc_string.rb', line 35 def to_s text = "\"\"\"#{content_type_output_string}\n" text << contents_output_string text << '"""' end |