Class: CollectionFilter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/collection_filter/base.rb

Direct Known Subclasses

Closed, Open

Class Method Summary collapse

Class Method Details

.can_filter?(object, block) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/collection_filter/base.rb', line 17

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

.filter_implementation_for(object, block) ⇒ Object



9
10
11
# File 'lib/collection_filter/base.rb', line 9

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

.filter_implementationsObject



13
14
15
# File 'lib/collection_filter/base.rb', line 13

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

.find_filter(object, block) ⇒ Object



5
6
7
# File 'lib/collection_filter/base.rb', line 5

def self.find_filter(object, block)
  filter_implementation_for(object, block).new
end