Sha256: 5f76e48d7718fd0e09dd3df073d731a703d6d7e9076d60915571aa7755362a00

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

module ActiveEnumerable
  module Where
    module WhereOrChain
      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

      attr_accessor :original_collection

      private

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_enumerable-1.1.0 lib/active_enumerable/where/where_or_chain.rb