class Formatter::Date::TimeOrDateTime

Wrapper class around TZInfo::TimeOrDateTime that only accepts Time or DateTime.

Public Class Methods

new(object) click to toggle source
Calls superclass method
# File lib/formatter/date.rb, line 12
def initialize(object)
  case object
  when Time
    object = object.utc
  when DateTime
    object = object.new_offset Rational(0, 24)
  else
    fail ArgumentError, "invalid Time or DateTime: #{object.inspect}"
  end

  super TZInfo::TimeOrDateTime.wrap(object)
end