Class: CukeModeler::DocString
- Includes:
- Parsed, Parsing, 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 included from Parsing
Methods inherited from Model
Methods included from Containing
#each, #each_descendant, #each_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.
| 21 22 23 24 25 26 27 28 | # File 'lib/cuke_modeler/models/doc_string.rb', line 21 def initialize(source_text = nil) super(source_text) return unless source_text parsed_doc_string_data = parse_source(source_text) populate_docstring(self, parsed_doc_string_data) end | 
Instance Attribute Details
#content ⇒ Object
The content of the doc string
| 16 17 18 | # File 'lib/cuke_modeler/models/doc_string.rb', line 16 def content @content end | 
#content_type ⇒ Object
The content type associated with the doc string
| 13 14 15 | # File 'lib/cuke_modeler/models/doc_string.rb', line 13 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.
| 32 33 34 35 36 | # File 'lib/cuke_modeler/models/doc_string.rb', line 32 def to_s text = "\"\"\"#{content_type_output_string}\n" text << content_output_string text << '"""' end |