Class: InstanceAccountant::Hour

Inherits:
Object
  • Object
show all
Defined in:
lib/instance_accountant/hour.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = { }) ⇒ Hour

Returns a new instance of Hour.



6
7
8
# File 'lib/instance_accountant/hour.rb', line 6

def initialize options = { }
  @time = options[:time] ? options[:time].utc : now(options)
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
# File 'lib/instance_accountant/hour.rb', line 10

def == other
  hour_string == other.hour_string
end

#hour_stringObject



18
19
20
# File 'lib/instance_accountant/hour.rb', line 18

def hour_string
  to_s[0..12] + ':00:00Z'
end

#to_sObject



14
15
16
# File 'lib/instance_accountant/hour.rb', line 14

def to_s
  @time.iso8601
end