public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/jdelStrother/rails.git
Ruby 1.8.7 compat: TimeWithZone# and Chars#respond_to? pass along the 
include_private argument
jeremy (author)
Sat May 31 14:54:17 -0700 2008
commit  4e4bcb4c6b08ed392cd5576dcfc252ef574a1b88
tree    3ee0296a3dfbdba16f2e113453a58207d52830db
parent  2243ffd1ffe3a129af20a33e72574f7ee4534730
...
40
41
42
43
 
44
45
46
47
 
 
 
 
 
48
49
 
50
51
52
...
40
41
42
 
43
44
 
 
 
45
46
47
48
49
50
 
51
52
53
54
0
@@ -40,13 +40,15 @@ module ActiveSupport::Multibyte #:nodoc:
0
       # core dumps. Don't go there.
0
       @string
0
     end
0
-
0
+
0
     # Make duck-typing with String possible
0
- def respond_to?(method)
0
- super || @string.respond_to?(method) || handler.respond_to?(method) ||
0
- (method.to_s =~ /(.*)!/ && handler.respond_to?($1)) || false
0
+ def respond_to?(method, include_priv = false)
0
+ super || @string.respond_to?(method, include_priv) ||
0
+ handler.respond_to?(method, include_priv) ||
0
+ (method.to_s =~ /(.*)!/ && handler.respond_to?($1, include_priv)) ||
0
+ false
0
     end
0
-
0
+
0
     # Create a new Chars instance.
0
     def initialize(str)
0
       @string = str.respond_to?(:string) ? str.string : str
...
248
249
250
251
 
252
253
 
254
255
256
 
257
258
 
259
260
261
...
248
249
250
 
251
252
 
253
254
255
 
256
257
 
258
259
260
261
0
@@ -248,14 +248,14 @@ module ActiveSupport
0
     def marshal_load(variables)
0
       initialize(variables[0], ::Time.send!(:get_zone, variables[1]), variables[2])
0
     end
0
-
0
+
0
     # Ensure proxy class responds to all methods that underlying time instance responds to.
0
- def respond_to?(sym)
0
+ def respond_to?(sym, include_priv = false)
0
       # consistently respond false to acts_like?(:date), regardless of whether #time is a Time or DateTime
0
       return false if sym.to_s == 'acts_like_date?'
0
- super || time.respond_to?(sym)
0
+ super || time.respond_to?(sym, include_priv)
0
     end
0
-
0
+
0
     # Send the missing method to +time+ instance, and wrap result in a new TimeWithZone with the existing +time_zone+.
0
     def method_missing(sym, *args, &block)
0
       result = time.__send__(sym, *args, &block)

Comments

    No one has commented yet.