123456789_123456789_123456789_123456789_123456789_

Class: Rails::SourceAnnotationExtractor::ParserExtractor::Parser

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Ripper
Instance Chain:
self, Ripper
Inherits: Ripper
  • ::Object
Defined in: railties/lib/rails/source_annotation_extractor.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(source, pattern:) ⇒ Parser

[ GitHub ]

  
# File 'railties/lib/rails/source_annotation_extractor.rb', line 22

def initialize(source, pattern:)
  super(source)
  @pattern = pattern
  @comments = []
end

Instance Attribute Details

#comments (readonly)

[ GitHub ]

  
# File 'railties/lib/rails/source_annotation_extractor.rb', line 20

attr_reader :comments, :pattern

#pattern (readonly)

[ GitHub ]

  
# File 'railties/lib/rails/source_annotation_extractor.rb', line 20

attr_reader :comments, :pattern

Instance Method Details

#on_comment(value)

[ GitHub ]

  
# File 'railties/lib/rails/source_annotation_extractor.rb', line 28

def on_comment(value)
  @comments << Annotation.new(lineno, $1, $2) if value =~ pattern
end