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.
38 39 40 41 42 |
# File 'lib/rails/source_annotation_extractor.rb', line 38 def initialize(source, pattern:) super(source) @pattern = pattern @comments = [] end |
Instance Attribute Details
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
36 37 38 |
# File 'lib/rails/source_annotation_extractor.rb', line 36 def comments @comments end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
36 37 38 |
# File 'lib/rails/source_annotation_extractor.rb', line 36 def pattern @pattern end |
Instance Method Details
#on_comment(value) ⇒ Object
44 45 46 |
# File 'lib/rails/source_annotation_extractor.rb', line 44 def on_comment(value) @comments << Annotation.new(lineno, $1, $2) if value =~ pattern end |