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.
78 79 80 81 |
# File 'lib/syntax_tree/index.rb', line 78 def initialize(*) super @comments = {} end |
Instance Attribute Details
#comments ⇒ Object (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 |