Class: Rails::SourceAnnotationExtractor::ParserExtractor::Parser
- Inherits:
-
Ripper
- Object
- Ripper
- Rails::SourceAnnotationExtractor::ParserExtractor::Parser
- Defined in:
- lib/rails/source_annotation_extractor.rb
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(source, pattern:) ⇒ Parser
constructor
A new instance of Parser.
- #on_comment(value) ⇒ Object
Constructor Details
#initialize(source, pattern:) ⇒ Parser
Returns a new instance of Parser.
22 23 24 25 26 |
# File 'lib/rails/source_annotation_extractor.rb', line 22 def initialize(source, pattern:) super(source) @pattern = pattern @comments = [] end |
Instance Attribute Details
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
20 21 22 |
# File 'lib/rails/source_annotation_extractor.rb', line 20 def comments @comments end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
20 21 22 |
# File 'lib/rails/source_annotation_extractor.rb', line 20 def pattern @pattern end |
Instance Method Details
#on_comment(value) ⇒ Object
28 29 30 |
# File 'lib/rails/source_annotation_extractor.rb', line 28 def on_comment(value) @comments << Annotation.new(lineno, $1, $2) if value =~ pattern end |