Method: Wherelizer#convert

Defined in:
lib/wherelizer.rb

#convertObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/wherelizer.rb', line 19

def convert
  @parsed = RubyParser.new.parse(orig)
  assignment = handle_assignment

  receiver = ruby2ruby.process(parsed.extract_receiver)
  method_name = handle_method_name
  options_hash = parsed.to_hash

  where = parse_conditions(options_hash.delete(:conditions)) if options_hash[:conditions]
  others = options_hash.map{|key, value| parse_basic_param(key, value)}.join

  "#{assignment}#{receiver}#{where}#{others}#{method_name}"
rescue => e
  raise ConvertException.new("Unable to convert: #{e.message}")
end