class CukeModeler::Comment
A class modeling a comment in a feature file.
Attributes
text[RW]
The text of the comment
Public Class Methods
new(source_text = nil)
click to toggle source
Creates a new Comment
object and, if source_text is provided, populates the object.
Calls superclass method
# File lib/cuke_modeler/models/comment.rb, line 17 def initialize(source_text = nil) super(source_text) return unless source_text parsed_comment_data = parse_source(source_text) populate_comment(self, parsed_comment_data) end
Public Instance Methods
to_s()
click to toggle source
Returns a string representation of this model. For a comment model, this will be Gherkin text that is equivalent to the comment being modeled.
# File lib/cuke_modeler/models/comment.rb, line 28 def to_s text || '' end
Private Instance Methods
parse_source(source_text)
click to toggle source
# File lib/cuke_modeler/models/comment.rb, line 36 def parse_source(source_text) base_file_string = "\n#{dialect_feature_keyword}: Fake feature to parse" source_text = "# language: #{Parsing.dialect}\n" + source_text + base_file_string parsed_file = Parsing.parse_text(source_text, 'cuke_modeler_stand_alone_comment.feature') parsed_file['comments'].last end