Class: Timestream::Hamster::Timestream
- Inherits:
-
Object
- Object
- Timestream::Hamster::Timestream
- Defined in:
- lib/timestream/hamster.rb
Instance Method Summary collapse
- #[](date) ⇒ Object
- #[]=(date, hours) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ Timestream
constructor
A new instance of Timestream.
Constructor Details
#initialize ⇒ Timestream
Returns a new instance of Timestream.
76 77 78 |
# File 'lib/timestream/hamster.rb', line 76 def initialize @hours_by_date = Hash.new(0) end |
Instance Method Details
#[](date) ⇒ Object
68 69 70 |
# File 'lib/timestream/hamster.rb', line 68 def [](date) @hours_by_date[date] end |
#[]=(date, hours) ⇒ Object
72 73 74 |
# File 'lib/timestream/hamster.rb', line 72 def []=(date, hours) @hours_by_date[date] = hours end |
#each(&block) ⇒ Object
80 81 82 |
# File 'lib/timestream/hamster.rb', line 80 def each(&block) @hours_by_date.sort.each(&block) end |