aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-17 19:51:52 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-17 19:51:52 -0200
commit320f75baafe36d7c81c01d4e1c42b984704f1bbb (patch)
tree363d5fbd58826613606ff61d3cfbd08f127d45e1
parenteec0441c118eff2f7647a1e645abbb166b77a529 (diff)
parent05affb2cf98d947e44a840c53d26750061c4f342 (diff)
downloadrails-320f75baafe36d7c81c01d4e1c42b984704f1bbb.tar.gz
rails-320f75baafe36d7c81c01d4e1c42b984704f1bbb.tar.bz2
rails-320f75baafe36d7c81c01d4e1c42b984704f1bbb.zip
Merge pull request #18063 from claudiob/remove-as-time-with-zone-since
Replace AS::TimeWithZone#since with alias to +
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb11
1 files changed, 1 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index fb10b40b84..0c6b4f445b 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -276,6 +276,7 @@ module ActiveSupport
result.in_time_zone(time_zone)
end
end
+ alias_method :since, :+
# Returns a new TimeWithZone object that represents the difference between
# the current object's time and the +other+ time.
@@ -304,16 +305,6 @@ module ActiveSupport
end
end
- def since(other)
- # If we're adding a Duration of variable length (i.e., years, months, days), move forward from #time,
- # otherwise move forward from #utc, for accuracy when moving across DST boundaries
- if duration_of_variable_length?(other)
- method_missing(:since, other)
- else
- utc.since(other).in_time_zone(time_zone)
- end
- end
-
def ago(other)
since(-other)
end