Class: Hubkit::NotCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/hubkit/chainable_collection.rb

Overview

A collection that lets you perform the inverse of a filter

Examples:

repo.issues.not.labeled('in progress')

Instance Method Summary collapse

Constructor Details

#initialize(base) ⇒ 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.

Yield Parameters:

  • ...

    the parameters of the any block given to the method which is being 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