Class: Rbr::CommentNode

Inherits:
Object
  • Object
show all
Defined in:
lib/rbr/comment_node.rb

Overview

Wraps a Parser::Source::Comment object and provides convenience methods

Instance Method Summary collapse

Constructor Details

#initialize(parser_comment) ⇒ CommentNode

Returns a new instance of CommentNode.



6
7
8
# File 'lib/rbr/comment_node.rb', line 6

def initialize(parser_comment)
  @parser_comment = parser_comment
end

Instance Method Details

#expressionObject



10
11
12
# File 'lib/rbr/comment_node.rb', line 10

def expression
  @parser_comment.loc.expression
end

#pretty_printObject



14
15
16
# File 'lib/rbr/comment_node.rb', line 14

def pretty_print
  "#{expression.line}: #{@parser_comment.text}"
end