1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #15313 from andreychernih/time-with-zone-string-conversion-speed-up

Speed-up TimeWithZone to String conversion
This commit is contained in:
Rafael Mendonça França 2014-05-30 11:52:59 -03:00
commit 8c77b0a086

View file

@ -353,6 +353,14 @@ module ActiveSupport
initialize(variables[0].utc, ::Time.find_zone(variables[1]), variables[2].utc)
end
# respond_to_missing? is not called in some cases, such as when type conversion is
# performed with Kernel#String
def respond_to?(sym, include_priv = false)
# ensure that we're not going to throw and rescue from NoMethodError in method_missing which is slow
return false if sym.to_sym == :to_str
super
end
# Ensure proxy class responds to all methods that underlying time instance
# responds to.
def respond_to_missing?(sym, include_priv)