Class: SyntaxTree::Index::FileComments::Parser

Inherits:
Ripper
  • Object
show all
Defined in:
lib/syntax_tree/index.rb

Overview

We use the ripper library to pull out source comments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.



103
104
105
106
# File 'lib/syntax_tree/index.rb', line 103

def initialize(*)
  super
  @comments = {}
end

Instance Attribute Details

#commentsObject (readonly)

Returns the value of attribute comments.



101
102
103
# File 'lib/syntax_tree/index.rb', line 101

def comments
  @comments
end

Instance Method Details

#on_comment(value) ⇒ Object



108
109
110
# File 'lib/syntax_tree/index.rb', line 108

def on_comment(value)
  comments[lineno] = value.chomp
end