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 38

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 36

attr_reader :comments, :pattern

#pattern (readonly)

[ GitHub ]

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

attr_reader :comments, :pattern

Instance Method Details

#on_comment(value)

[ GitHub ]

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

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