Class: CollectionFilter::Base
- Inherits:
-
Object
- Object
- CollectionFilter::Base
- Defined in:
- lib/collection_filter/base.rb
Class Method Summary collapse
- .can_filter?(object, block) ⇒ Boolean
- .filter_implementation_for(object, block) ⇒ Object
- .filter_implementations ⇒ Object
- .find_filter(object, block) ⇒ Object
Class Method Details
.can_filter?(object, block) ⇒ 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_implementations ⇒ Object
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 |