Class: ArelConverter::Translator::Finder
- Defined in:
- lib/arel_converter/translators/finder.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#format_for_hash, #logger, parse, #post_processing, translate
Instance Method Details
#process_call(exp) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/arel_converter/translators/finder.rb', line 5 def process_call(exp) case exp[1] when :all, :first parent = process(exp.shift) method = (exp.shift == :first ? 'first' : 'all') unless exp.empty? = Options.translate(exp.shift).strip method = nil if method == 'all' end [parent, , method].compact.join('.') when :find parent = process(exp.shift) exp.shift # Replacing so we can discard the :find definition first_or_all = process(exp.shift) == ':first' ? 'first' : nil = Options.translate(exp.shift).strip unless exp.empty? [parent, , first_or_all].compact.join('.') else super end end |