Class: RubbishCollection::Collections
- Inherits:
-
Object
- Object
- RubbishCollection::Collections
- Includes:
- Comparable
- Defined in:
- lib/rubbish_collection.rb
Instance Method Summary collapse
- #<<(collection) ⇒ Object
- #each ⇒ Object
-
#initialize ⇒ Collections
constructor
A new instance of Collections.
- #upto(until_date) ⇒ Object
Constructor Details
#initialize ⇒ Collections
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 |
#each ⇒ Object
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 |