Sha256: c00fa78fda56fb6702a76eceefb35166a5d1f919308f9d2e607acdc0c80b7c1f

Contents?: true

Size: 504 Bytes

Versions: 1

Compression:

Stored size: 504 Bytes

Contents

require 'error_handling_protocol'

module CollectionFilter
  class Base
    def self.find_filter(object, block)
      filter_implementation_for(object, block).new
    end

    def self.filter_implementation_for(object, block)
      filter_implementations.detect { |each| each.can_filter?(object, block) }
    end

    def self.filter_implementations
      [CollectionFilter::Open, CollectionFilter::Closed]
    end

    def self.can_filter?(object, block)
      subclass_responsibility
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
collection_filter-0.0.1 lib/collection_filter/base.rb