class ISO8601Basic::DateTime

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# 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

Public Instance Methods

+(other) click to toggle source
Calls superclass method
# 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() click to toggle source
# File lib/iso8601_basic/date_time.rb, line 30
def inspect
  "#<ISO8601Basic::DateTime: #{iso8601}>"
end
to_iso8601_date() click to toggle source
# File lib/iso8601_basic/date_time.rb, line 13
def to_iso8601_date
  ISO8601Basic::Date.new year, month, day
end
to_iso8601_time() click to toggle source
# File lib/iso8601_basic/date_time.rb, line 17
def to_iso8601_time
  ISO8601Basic::Time.new hour, minute, second, zone
end