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.



78
79
80
81
# File 'lib/syntax_tree/index.rb', line 78

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

Instance Attribute Details

#commentsObject (readonly)

Returns the value of attribute comments.



76
77
78
# File 'lib/syntax_tree/index.rb', line 76

def comments
  @comments
end

Instance Method Details

#on_comment(value) ⇒ Object



83
84
85
# File 'lib/syntax_tree/index.rb', line 83

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