Class: CollectionFilter::Undefined

Inherits:
BasicObject
Defined in:
lib/collection_filter/undefined.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection, block) ⇒ Undefined

Returns a new instance of Undefined.



7
8
9
10
# File 'lib/collection_filter/undefined.rb', line 7

def initialize(collection, block)
  @collection = collection
  @condition = block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(selector, *args, &block) ⇒ Object (private)



30
31
32
# File 'lib/collection_filter/undefined.rb', line 30

def method_missing(selector, *args, &block)
  @collection.send(selector, *args, &block)
end

Class Method Details

.filter_with(collection, block) ⇒ Object



3
4
5
# File 'lib/collection_filter/undefined.rb', line 3

def self.filter_with(collection, block)
  new(collection, block)
end

Instance Method Details

#<<(object) ⇒ Object



12
13
14
# File 'lib/collection_filter/undefined.rb', line 12

def <<(object)
  filter_for(object).add(object, @collection)
end

#respond_to?(selector, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/collection_filter/undefined.rb', line 16

def respond_to?(selector, include_private=false)
  @collection.respond_to?(selector, include_private)
end