Class: ArelConverter::Scope
- Inherits:
-
Base
- Object
- Base
- ArelConverter::Scope
show all
- Defined in:
- lib/arel_converter/scope.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
Instance Method Details
#grep_matches_in_file(file) ⇒ Object
4
5
6
7
|
# File 'lib/arel_converter/scope.rb', line 4
def grep_matches_in_file(file)
raw_named_scopes = `grep -h -r "^\s*scope\s*:" #{file}`
raw_named_scopes.split("\n")
end
|
#process_line(line) ⇒ Object
9
10
11
12
|
# File 'lib/arel_converter/scope.rb', line 9
def process_line(line)
new_scope = ArelConverter::Translator::Scope.translate(line)
new_scope.gsub(/scope\((.*)\)$/, 'scope \1')
end
|
#verify_line(line) ⇒ Object
14
15
16
17
18
|
# File 'lib/arel_converter/scope.rb', line 14
def verify_line(line)
parser = RubyParser.new
sexp = parser.process(line)
sexp[0] == :call && sexp[2] == :scope
end
|