Class: Timestream::Hamster::Timestream

Inherits:
Object
  • Object
show all
Defined in:
lib/timestream/hamster.rb

Instance Method Summary collapse

Constructor Details

#initializeTimestream

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