diff options
author | Jay Pignata <john.pignata@gmail.com> | 2009-08-31 13:02:19 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-08-31 13:02:19 -0500 |
commit | 7316d029e60f5d531b35af9e66d233ea19e4f240 (patch) | |
tree | 1a93425e44c9feb13ef2049c8b99aa2924a131f2 /activesupport/lib/active_support/core_ext/date/calculations.rb | |
parent | 80989437dc1502f9194b0600941b6d70a3efa3b2 (diff) | |
download | rails-7316d029e60f5d531b35af9e66d233ea19e4f240.tar.gz rails-7316d029e60f5d531b35af9e66d233ea19e4f240.tar.bz2 rails-7316d029e60f5d531b35af9e66d233ea19e4f240.zip |
Duplicating the options hash in Date#advance to prevent modification of the original [#1133 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date/calculations.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/date/calculations.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb index 1fe4ffb8e1..ce3bebc25a 100644 --- a/activesupport/lib/active_support/core_ext/date/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date/calculations.rb @@ -82,6 +82,7 @@ class Date # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with # any of these keys: <tt>:years</tt>, <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>. def advance(options) + options = options.dup d = self d = d >> options.delete(:years) * 12 if options[:years] d = d >> options.delete(:months) if options[:months] |