lib/timeliness/parser.rb in timeliness-0.4.2 vs lib/timeliness/parser.rb in timeliness-0.4.3

- old
+ new

@@ -103,11 +103,11 @@ Time.use_zone(zone) { Time.current } end end def shift_time_to_zone(time, zone=nil) - zone ||= Timeliness.default_timezone + zone ||= Timeliness.configuration.default_timezone case zone when :utc, :local time.send("get#{zone}") when :current time.in_time_zone @@ -115,11 +115,11 @@ Time.use_zone(zone) { time.in_time_zone } end end def create_time_in_zone(time_array, zone=nil) - zone ||= Timeliness.default_timezone + zone ||= Timeliness.configuration.default_timezone case zone when :utc, :local time_with_datetime_fallback(zone, *time_array) when :current Time.zone.local(*time_array) @@ -151,14 +151,16 @@ def fast_date_valid_with_fallback(year, month, day) month && month < 13 && (day < 29 || Date.valid_civil?(year, month, day)) end def evaluate_date_for_time_type - case Timeliness.date_for_time_type + date_for_time_type = Timeliness.configuration.date_for_time_type + + case date_for_time_type when Array - Timeliness.date_for_time_type + date_for_time_type when Proc - v = Timeliness.date_for_time_type.call + v = date_for_time_type.call [v.year, v.month, v.day] end end end