class Parser::Source::Comment

@return Parser::Source::Map
@!attribute [r] location
@return String
@!attribute [r] text
@api public
#

def self.associate(ast, comments)

Other tags:
    See: Parser::Source::Comment::Associator -
def self.associate(ast, comments)
  associator = Associator.new(comments, ast)
  associator.associate
end

def ==(other)

Returns:
  • (TrueClass|FalseClass) -

Parameters:
  • other (Object) --
def ==(other)
  other.is_a?(Source::Comment) &&
    @location == other.location
end

def document?

Returns:
  • (TrueClass|FalseClass) -

Other tags:
    See: [#type] -
def document?
  type == :document
end

def initialize(range)

Parameters:
  • range (Parser::Source::Range) --
def initialize(range)
  @location = Parser::Source::Map.new(range)
  @text     = range.source.freeze
  freeze
end

def inline?

Returns:
  • (TrueClass|FalseClass) -

Other tags:
    See: [#type] -
def inline?
  type == :inline
end

def type

=end
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