Class: Rails::SourceAnnotationExtractor::PatternExtractor
- Defined in:
 - railties/lib/rails/source_annotation_extractor.rb
 
Overview
Wraps a regular expression that will iterate through a file’s lines and test each one for the given pattern.
Instance Attribute Summary collapse
- 
  
    
      #pattern  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute pattern.
 
Instance Method Summary collapse
Methods inherited from Struct
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern
      59 60 61  | 
    
      # File 'railties/lib/rails/source_annotation_extractor.rb', line 59 def pattern @pattern end  | 
  
Instance Method Details
#annotations(file) ⇒ Object
      60 61 62 63 64 65 66 67 68  | 
    
      # File 'railties/lib/rails/source_annotation_extractor.rb', line 60 def annotations(file) lineno = 0 File.readlines(file, encoding: Encoding::BINARY).inject([]) do |list, line| lineno += 1 next list unless line =~ pattern list << Annotation.new(lineno, $1, $2) end end  |