diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2009-02-09 23:12:47 -0600 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2009-02-09 23:12:47 -0600 |
commit | 3c6bf82115e184f9c819e5797d3822b6b9daeb14 (patch) | |
tree | 69dd76ae8d6e293649fff99f9341c6e690c1283b /activesupport/lib/active_support | |
parent | 16cc69af6f29a1562db3cf9e37ae7f3751956f4a (diff) | |
download | rails-3c6bf82115e184f9c819e5797d3822b6b9daeb14.tar.gz rails-3c6bf82115e184f9c819e5797d3822b6b9daeb14.tar.bz2 rails-3c6bf82115e184f9c819e5797d3822b6b9daeb14.zip |
TimeWithZone#advance: leverage Hash#values_at and non-block form of #any? for a little less line noise, and a slight speedup (thanks raggi and Roman2K)
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index e9e536c267..518ca7742f 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -230,7 +230,7 @@ module ActiveSupport def advance(options) # If we're advancing a value of variable length (i.e., years, weeks, months, days), advance from #time, # otherwise advance from #utc, for accuracy when moving across DST boundaries - if options.any? {|k,v| [:years, :weeks, :months, :days].include? k} + if options.values_at(:years, :weeks, :months, :days).any? method_missing(:advance, options) else utc.advance(options).in_time_zone(time_zone) |