Class: SyntaxTree::Index::FileComments::Parser
- Inherits:
-
Ripper
- Object
- Ripper
- SyntaxTree::Index::FileComments::Parser
- Defined in:
- lib/syntax_tree/index.rb
Overview
We use the ripper library to pull out source comments.
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
Instance Method Summary collapse
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
- #on_comment(value) ⇒ Object
Constructor Details
#initialize ⇒ Parser
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
#comments ⇒ Object (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 |