Sha256: c6e789abeac8c91ab69ec64ec79bc6924015d40bce38a3761e830b0e61bcad9b

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

# filter1 = Qfill::Filter.new( -> (object, stuff, stank) { object.is_awesome_enough_to_be_in_results?(stuff, stank) }, stuff, stank)
# filter2 = Qfill::Filter.new( -> (object, rank, bank) { object.is_awesome_enough_to_be_in_results?(rank, bank) }, rank, bank)
#
# Filters are destructive. If an item is filtered from a Result list it is lost, since it has already been popped off the origin list, and won't be coming back
module Qfill
  class Filter
    attr_accessor :processor, :processor_arguments

    def initialize(proc, *params)
      @processor = proc
      @processor_arguments = params
    end

    def run(*args)
      processor.call(*args, *processor_arguments)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qfill-0.1.1 lib/qfill/filter.rb
qfill-0.1.0 lib/qfill/filter.rb