Class: Hubkit::NotCollection
- Inherits:
-
Object
- Object
- Hubkit::NotCollection
- Defined in:
- lib/hubkit/chainable_collection.rb
Overview
A collection that lets you perform the inverse of a filter
Instance Method Summary collapse
-
#initialize(base) ⇒ NotCollection
constructor
A new instance of NotCollection.
-
#method_missing(name, *args) {|...| ... } ⇒ ChainableCollection
Any method of this class will be delegated down to the original ChainableCollection.
Constructor Details
#initialize(base) ⇒ NotCollection
Returns a new instance of NotCollection.
88 89 90 |
# File 'lib/hubkit/chainable_collection.rb', line 88 def initialize(base) @base = base end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) {|...| ... } ⇒ ChainableCollection
Any method of this class will be delegated down to the original ChainableCollection. The result of the method will be a ChainableCollection which contains all the elements not returned by the filter called.
102 103 104 |
# File 'lib/hubkit/chainable_collection.rb', line 102 def method_missing(name, *args, &block) @base.wrap(@base - @base.send(name, *args, &block)) end |