Class: Lucid::AST::Comment
Overview
:nodoc:
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.
4 5 6 |
# File 'lib/lucid/ast/comment.rb', line 4 def initialize(value) @value = value end |
Instance Method Details
#accept(visitor) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/lucid/ast/comment.rb', line 12 def accept(visitor) return if empty? visitor.visit_comment(self) do @value.strip.split("\n").each do |line| visitor.visit_comment_line(line.strip) end end end |
#empty? ⇒ Boolean
8 9 10 |
# File 'lib/lucid/ast/comment.rb', line 8 def empty? @value.nil? || @value == "" end |
#to_sexp ⇒ Object
22 23 24 |
# File 'lib/lucid/ast/comment.rb', line 22 def to_sexp (@value.nil? || @value == '') ? nil : [:comment, @value] end |