lib/tzinfo/timezone.rb in tzinfo-0.3.8 vs lib/tzinfo/timezone.rb in tzinfo-0.3.9

- old
+ new

@@ -369,12 +369,12 @@ # Converts a time in UTC to the local timezone. utc can either be # a DateTime, Time or timestamp (Time.to_i). The returned time has the same # type as utc. Any timezone information in utc is ignored (it is treated as # a UTC time). def utc_to_local(utc) - TimeOrDateTime.wrap(utc) {|utc| - period_for_utc(utc).to_local(utc) + TimeOrDateTime.wrap(utc) {|wrapped| + period_for_utc(wrapped).to_local(wrapped) } end # Converts a time in the local timezone to UTC. local can either be # a DateTime, Time or timestamp (Time.to_i). The returned time has the same @@ -408,17 +408,17 @@ # specified, it is called. The block must take a single parameter - an # array of the periods that need to be resolved. The block can return a # single period to use to convert the time or return nil or an empty array # to cause an AmbiguousTime exception to be raised. def local_to_utc(local, dst = nil) - TimeOrDateTime.wrap(local) {|local| + TimeOrDateTime.wrap(local) {|wrapped| if block_given? - period = period_for_local(local, dst) {|periods| yield periods } + period = period_for_local(wrapped, dst) {|periods| yield periods } else - period = period_for_local(local, dst) + period = period_for_local(wrapped, dst) end - period.to_utc(local) + period.to_utc(wrapped) } end # Returns the current time in the timezone as a Time. def now