Sha256: 9bb5e3d20b7881183a622b813fff39d95b52b87825864be74dd3ba0a92b64ebd

Contents?: true

Size: 530 Bytes

Versions: 6

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

require_relative '../adapter_base'

class ActiveSet
  class Processor::Filter < Processor::Base
    class EnumerableAdapter < Adapter::Base
      def process
        return false unless @set.respond_to? :select

        @instructions.reduce(@set) do |set, instruction|
          set.select do |item|
            instruction.value_for(item: item)
                       .send(instruction.operator,
                             instruction.value)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activeset-0.6.5 lib/active_set/processor_filter/enumerable_adapter.rb
activeset-0.6.4 lib/active_set/processor_filter/enumerable_adapter.rb
activeset-0.6.3 lib/active_set/processor_filter/enumerable_adapter.rb
activeset-0.6.2 lib/active_set/processor_filter/enumerable_adapter.rb
activeset-0.6.1 lib/active_set/processor_filter/enumerable_adapter.rb
activeset-0.6.0 lib/active_set/processor_filter/enumerable_adapter.rb