./lib/ambition/processor.rb in ambition-0.1.6 vs ./lib/ambition/processor.rb in ambition-0.2.0
- old
+ new
@@ -1,21 +1,16 @@
require 'active_record/connection_adapters/abstract/quoting'
module Ambition
- class Processor < SexpProcessor
+ class Processor
include ActiveRecord::ConnectionAdapters::Quoting
attr_reader :key, :join_string, :prefix, :includes
def initialize
- super()
- @strict = false
- @expected = String
- @auto_shift_type = true
- @warn_on_default = false
- @default_method = :process_error
- @includes = []
+ @unsupported = [:alloca, :cfunc, :cref, :evstr, :ifunc, :last, :memo, :newline, :opt_n, :method] # internal nodes that you can't get to
+ @includes = []
end
##
# Processing methods
def process_error(exp)
@@ -89,8 +84,13 @@
@includes << reflection.name unless @includes.include? reflection.name
"#{reflection.table_name}.#{method}"
else
raise "No reflection `#{receiver.last}' found on #{@owner}"
end
+ end
+
+ def process(node)
+ node ||= []
+ respond_to?(method = "process_#{node.shift}") ? send(method, node) : ''
end
end
end