class ISO8601Basic::Time
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/iso8601_basic/time.rb, line 3 def self.new(*args) case value = args[0] when Numeric super 2000, 1, 1, *args when String value = "T#{value}" unless value[0] == 'T' dt = ::DateTime.iso8601 "2000-01-01#{value}" super 2000, 1, 1, dt.hour, dt.minute, dt.second, dt.zone else super end end
Public Instance Methods
+(other)
click to toggle source
Calls superclass method
# File lib/iso8601_basic/time.rb, line 14 def +(other) case other when ISO8601Basic::Date ISO8601Basic::DateTime.new other.year, other.month, other.day, hour, minute, second, zone when ISO8601Basic::Duration seconds = [:hours, :minutes, :seconds].collect do |key| { seconds: 1, minutes: 60, hours: 3600 }[key] * other.to_h[key] end.inject :+ super Rational(seconds.round, 86400) else super end end
inspect()
click to toggle source
# File lib/iso8601_basic/time.rb, line 31 def inspect "#<ISO8601Basic::Time: #{iso8601}>" end
iso8601()
click to toggle source
Calls superclass method
# File lib/iso8601_basic/time.rb, line 27 def iso8601 super[10..-1] end
to_s()
click to toggle source
# File lib/iso8601_basic/time.rb, line 35 def to_s iso8601 end