Class: CukeModeler::Comment
- Includes:
- Parsed, Parsing, Sourceable
- Defined in:
- lib/cuke_modeler/models/comment.rb
Overview
A class modeling a comment in a feature file.
Instance Attribute Summary collapse
-
#text ⇒ Object
The text of the comment.
Attributes included from Sourceable
Attributes included from Parsed
Attributes included from Nested
Instance Method Summary collapse
-
#initialize(source_text = nil) ⇒ Comment
constructor
Creates a new Comment object and, if source_text is provided, populates the object.
-
#inspect(verbose: false) ⇒ String
See ‘Object#inspect`.
-
#to_s ⇒ String
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) ⇒ Comment
Creates a new Comment object and, if source_text is provided, populates the object.
25 26 27 |
# File 'lib/cuke_modeler/models/comment.rb', line 25 def initialize(source_text = nil) super end |
Instance Attribute Details
#text ⇒ Object
The text of the comment
12 13 14 |
# File 'lib/cuke_modeler/models/comment.rb', line 12 def text @text end |
Instance Method Details
#inspect(verbose: false) ⇒ String
See ‘Object#inspect`. Returns some basic information about the object, including its class, object ID, and its most meaningful attribute. For a Comment model, this will be the text of the comment. If verbose is true, provides default Ruby inspection behavior instead.
52 53 54 55 56 |
# File 'lib/cuke_modeler/models/comment.rb', line 52 def inspect(verbose: false) return super if verbose "#{super.chop} @text: #{text.inspect}>" end |
#to_s ⇒ String
Returns a string representation of this model. For a Comment model, this will be Gherkin text that is equivalent to the comment being modeled.
36 37 38 |
# File 'lib/cuke_modeler/models/comment.rb', line 36 def to_s text || '' end |