C
Cris Shupp
All,
I am trying to open the Time class to add the following method.
I am always getting this error:
NameError: uninitialized constant Time::ZoneOffset
when referencing ZoneOffset. What am I doing wrong?
class Time
def self.offset_to_zone(offset)
offset = offset.to_i
ZoneOffset.each_pair do |time_zone, zone_offset| #ERROR OCCURS
HERE!!!
return time_zone if (zone_offset == offset)
end
raise ArgumentError, "Illegal arguments! The offset " <<
offset.to_s << " is unknown."
end
end
I am trying to open the Time class to add the following method.
I am always getting this error:
NameError: uninitialized constant Time::ZoneOffset
when referencing ZoneOffset. What am I doing wrong?
class Time
def self.offset_to_zone(offset)
offset = offset.to_i
ZoneOffset.each_pair do |time_zone, zone_offset| #ERROR OCCURS
HERE!!!
return time_zone if (zone_offset == offset)
end
raise ArgumentError, "Illegal arguments! The offset " <<
offset.to_s << " is unknown."
end
end