module ActiveEnumerable::Where::WhereOrChain

Attributes

original_collection[RW]

Public Instance Methods

or(conditions_or_relation) click to toggle source
# File lib/active_enumerable/where/where_or_chain.rb, line 4
def or(conditions_or_relation)
  conditions = get_conditions(conditions_or_relation)
  or_result  = create_where_relation(where_conditions, original_collection).where(conditions)
  create_where_relation(or_result.where_conditions, to_a.concat(or_result.to_a).uniq)
end

Private Instance Methods

get_conditions(conditions_or_relation) click to toggle source
# File lib/active_enumerable/where/where_or_chain.rb, line 14
def get_conditions(conditions_or_relation)
  if conditions_or_relation.respond_to?(:where_conditions)
    conditions_or_relation.where_conditions
  else
    conditions_or_relation
  end
end