Class: ArelConverter::ActiveRecordFinder

Inherits:
Base
  • Object
show all
Defined in:
lib/arel_converter/active_record_finder.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #parse_directory, #parse_file, #process_lines, #run!, #update_file

Constructor Details

This class inherits a constructor from ArelConverter::Base

Instance Method Details

#grep_matches_in_file(file) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/arel_converter/active_record_finder.rb', line 4

def grep_matches_in_file(file)
  raw_ar_finders = ''
  ["find(:all", "find(:first", "find.*:conditions =>", '\.all(', '\.first('].each do |v|
    raw_ar_finders += `grep -hr '#{v}' #{file}`
  end

  raw_ar_finders.split("\n")
end

#process_line(finder) ⇒ Object



13
14
15
# File 'lib/arel_converter/active_record_finder.rb', line 13

def process_line(finder)
  ArelConverter::Translator::Finder.translate(finder)
end