Class: Cucumber::Ast::Comment
Overview
Holds the value of a comment parsed from a feature file:
# Lorem ipsum
# dolor sit amet
This gets parsed into a Comment with value "# Lorem ipsum\n# dolor sit amet\n"
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(value) ⇒ Comment
constructor
A new instance of Comment.
- #to_sexp ⇒ Object
Constructor Details
#initialize(value) ⇒ Comment
Returns a new instance of Comment.
11 12 13 |
# File 'lib/cucumber/ast/comment.rb', line 11 def initialize(value) @value = value end |
Instance Method Details
#accept(visitor) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/cucumber/ast/comment.rb', line 19 def accept(visitor) return if $cucumber_interrupted @value.strip.split("\n").each do |line| visitor.visit_comment_line(line.strip) end end |
#empty? ⇒ Boolean
15 16 17 |
# File 'lib/cucumber/ast/comment.rb', line 15 def empty? @value.nil? || @value == "" end |
#to_sexp ⇒ Object
26 27 28 |
# File 'lib/cucumber/ast/comment.rb', line 26 def to_sexp (@value.nil? || @value == '') ? nil : [:comment, @value] end |