module Mincer::Processors::Helpers
Public Instance Methods
join_expressions(expressions, join_with)
click to toggle source
# File lib/mincer/processors/helpers.rb, line 5 def join_expressions(expressions, join_with) return expressions.first if expressions.size < 2 case join_with when :and then Arel::Nodes::And.new(expressions) when :or then expressions.inject { |accumulator, expression| Arel::Nodes::Or.new(accumulator, expression) } else expressions.inject { |accumulator, expression| Arel::Nodes::InfixOperation.new(join_with, accumulator, expression) } end end