Class: ISO8601Basic::DateTime
- Inherits:
-
DateTime
- Object
- DateTime
- ISO8601Basic::DateTime
- Defined in:
- lib/iso8601_basic/date_time.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new(*args) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/iso8601_basic/date_time.rb', line 3 def self.new(*args) case value = args[0] when Numeric then super when String dt = ::DateTime.iso8601 value super dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.zone else super end end |
Instance Method Details
#+(other) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/iso8601_basic/date_time.rb', line 21 def +(other) case other when ISO8601Basic::Duration date = to_iso8601_date + other time = to_iso8601_time + other date + time else super end end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/iso8601_basic/date_time.rb', line 30 def inspect "#<ISO8601Basic::DateTime: #{iso8601}>" end |
#to_iso8601_date ⇒ Object
13 14 15 |
# File 'lib/iso8601_basic/date_time.rb', line 13 def to_iso8601_date ISO8601Basic::Date.new year, month, day end |
#to_iso8601_time ⇒ Object
17 18 19 |
# File 'lib/iso8601_basic/date_time.rb', line 17 def to_iso8601_time ISO8601Basic::Time.new hour, minute, second, zone end |