class Parser::Source::Comment
@return Parser::Source::Map
@!attribute [r] location
@return String
@!attribute [r] text
@api public
#
def self.associate(ast, comments)
- See: Parser::Source::Comment::Associator -
def self.associate(ast, comments) associator = Associator.new(comments, ast) associator.associate end
def ==(other)
-
(TrueClass|FalseClass)
-
Parameters:
-
other
(Object
) --
def ==(other) other.is_a?(Source::Comment) && @location == other.location end
def document?
-
(TrueClass|FalseClass)
-
Other tags:
- See: [#type] -
def document? type == :document end
def initialize(range)
-
range
(Parser::Source::Range
) --
def initialize(range) @location = Parser::Source::Map.new(range) @text = range.source.freeze freeze end
def inline?
-
(TrueClass|FalseClass)
-
Other tags:
- See: [#type] -
def inline? type == :inline end
def type
hi i am a document
=begin
* Block comments correspond to `:document`:
# whatever
* Inline comments correspond to `:inline`:
Returns the type of this comment.
#
def type case text when /^#/ :inline when /^=begin/ :document end end