aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-05-31 15:51:28 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-05-31 15:51:28 -0700
commitf32bceeee1adb0979f49db7e8111ba318e23c85c (patch)
tree56cc30f3e141cf702fcc1512d9d0355a51cc8db4 /activesupport/lib
parent9b75483bf361f44046d1cb86bd2acae6c4f856f3 (diff)
parent7391f7728d96c2ec0113de57f3316c191043ad2c (diff)
downloadrails-f32bceeee1adb0979f49db7e8111ba318e23c85c.tar.gz
rails-f32bceeee1adb0979f49db7e8111ba318e23c85c.tar.bz2
rails-f32bceeee1adb0979f49db7e8111ba318e23c85c.zip
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/dependencies.rb19
-rw-r--r--activesupport/lib/active_support/multibyte/chars.rb12
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb8
3 files changed, 21 insertions, 18 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 25225d5615..da2ece610a 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -82,9 +82,10 @@ module Dependencies #:nodoc:
# infinite loop with mutual dependencies.
loaded << expanded
- if load?
- log "loading #{file_name}"
- begin
+ begin
+ if load?
+ log "loading #{file_name}"
+
# Enable warnings iff this file has not been loaded before and
# warnings_on_first_load is set.
load_args = ["#{file_name}.rb"]
@@ -95,13 +96,13 @@ module Dependencies #:nodoc:
else
enable_warnings { result = load_file(*load_args) }
end
- rescue Exception
- loaded.delete expanded
- raise
+ else
+ log "requiring #{file_name}"
+ result = require file_name
end
- else
- log "requiring #{file_name}"
- result = require file_name
+ rescue Exception
+ loaded.delete expanded
+ raise
end
# Record history *after* loading so first load gets warnings.
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb
index ee716de39e..185d03020c 100644
--- a/activesupport/lib/active_support/multibyte/chars.rb
+++ b/activesupport/lib/active_support/multibyte/chars.rb
@@ -40,13 +40,15 @@ module ActiveSupport::Multibyte #:nodoc:
# core dumps. Don't go there.
@string
end
-
+
# Make duck-typing with String possible
- def respond_to?(method)
- super || @string.respond_to?(method) || handler.respond_to?(method) ||
- (method.to_s =~ /(.*)!/ && handler.respond_to?($1)) || false
+ def respond_to?(method, include_priv = false)
+ super || @string.respond_to?(method, include_priv) ||
+ handler.respond_to?(method, include_priv) ||
+ (method.to_s =~ /(.*)!/ && handler.respond_to?($1, include_priv)) ||
+ false
end
-
+
# Create a new Chars instance.
def initialize(str)
@string = str.respond_to?(:string) ? str.string : str
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index ece95eeae9..bfc5b16039 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -248,14 +248,14 @@ module ActiveSupport
def marshal_load(variables)
initialize(variables[0], ::Time.send!(:get_zone, variables[1]), variables[2])
end
-
+
# Ensure proxy class responds to all methods that underlying time instance responds to.
- def respond_to?(sym)
+ def respond_to?(sym, include_priv = false)
# consistently respond false to acts_like?(:date), regardless of whether #time is a Time or DateTime
return false if sym.to_s == 'acts_like_date?'
- super || time.respond_to?(sym)
+ super || time.respond_to?(sym, include_priv)
end
-
+
# Send the missing method to +time+ instance, and wrap result in a new TimeWithZone with the existing +time_zone+.
def method_missing(sym, *args, &block)
result = time.__send__(sym, *args, &block)