Class: RubbishCollection::Collections

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/rubbish_collection.rb

Instance Method Summary collapse

Constructor Details

#initializeCollections

Returns a new instance of Collections.



27
28
29
# File 'lib/rubbish_collection.rb', line 27

def initialize
  self.collections = []
end

Instance Method Details

#<<(collection) ⇒ Object



31
32
33
# File 'lib/rubbish_collection.rb', line 31

def << collection
  collections << collection
end

#eachObject



35
36
37
# File 'lib/rubbish_collection.rb', line 35

def each
  upto(Time.now + (86400 * 31)).each { |t| yield t }
end

#upto(until_date) ⇒ Object



40
41
42
43
# File 'lib/rubbish_collection.rb', line 40

def upto until_date
  now = Time.now
  collections.map { |c| c.realise now, until_date }.flatten.sort
end