Class: RuboCop::AST::NodePattern::Comment
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rubocop/ast/node_pattern/comment.rb |
Overview
A NodePattern comment, simplified version of ::Parser::Source::Comment
Class Method Summary
- .new(range) ⇒ Comment constructor
Instance Attribute Summary
Instance Method Summary
-
#==(other) ⇒ Boolean
Compares comments.
- #inspect ⇒ String
- #text ⇒ String
Constructor Details
.new(range) ⇒ Comment
Instance Attribute Details
#loc (readonly)
Alias for #location.
# File 'lib/rubocop/ast/node_pattern/comment.rb', line 9
alias loc location
#location (readonly) Also known as: #loc
[ GitHub ]# File 'lib/rubocop/ast/node_pattern/comment.rb', line 8
attr_reader :location
Instance Method Details
#==(other) ⇒ Boolean
Compares comments. Two comments are equal if they correspond to the same source range.
# File 'lib/rubocop/ast/node_pattern/comment.rb', line 31
def ==(other) other.is_a?(Comment) && @location == other.location end
#inspect ⇒ String
# File 'lib/rubocop/ast/node_pattern/comment.rb', line 39
def inspect "#<NodePattern::Comment #{@location.expression} #{text.inspect}>" end