aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG4
-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
-rw-r--r--activesupport/lib/active_support/version.rb4
-rw-r--r--activesupport/test/dependencies_test.rb20
6 files changed, 39 insertions, 28 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 7e408840c4..690bb987dc 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,3 +1,5 @@
+*2.1.0 (May 31st, 2008)*
+
* TimeZone#to_s shows offset as GMT instead of UTC, because GMT will be more familiar to end users (see time zone selects used by Windows OS, google.com and yahoo.com.) Reverts [8370] [Geoff Buesing]
* Hash.from_xml: datetime xml types overflow to Ruby DateTime class when out of range of Time. Adding tests for utc offsets [Geoff Buesing]
@@ -6,8 +8,6 @@
* Time#to_json: don't convert to utc before encoding. References #175 [Geoff Buesing]
-*2.1.0 RC1 (May 11th, 2008)*
-
* Remove unused JSON::RESERVED_WORDS, JSON.valid_identifier? and JSON.reserved_word? methods. Resolves #164. [Cheah Chu Yeow]
* Adding Date.current, which returns Time.zone.today if config.time_zone is set; otherwise returns Date.today [Geoff Buesing]
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 e6f2fd4e7c..4218ed5928 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -260,14 +260,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)
diff --git a/activesupport/lib/active_support/version.rb b/activesupport/lib/active_support/version.rb
index f3d141cf72..b346459a9b 100644
--- a/activesupport/lib/active_support/version.rb
+++ b/activesupport/lib/active_support/version.rb
@@ -1,8 +1,8 @@
module ActiveSupport
module VERSION #:nodoc:
MAJOR = 2
- MINOR = 0
- TINY = 991
+ MINOR = 1
+ TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
end
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index 1e19e12da9..0309ab6858 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -673,7 +673,7 @@ class DependenciesTest < Test::Unit::TestCase
assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it should have failed!"
end
end
-
+
ensure
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
end
@@ -686,11 +686,20 @@ class DependenciesTest < Test::Unit::TestCase
assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it should have failed!"
end
end
-
+
ensure
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
end
+ def test_autoload_doesnt_shadow_error_when_mechanism_not_set_to_load
+ with_loading 'autoloading_fixtures' do
+ Dependencies.mechanism = :require
+ 2.times do
+ assert_raise(NameError) {"RaisesNameError".constantize}
+ end
+ end
+ end
+
def test_autoload_doesnt_shadow_name_error
with_loading 'autoloading_fixtures' do
assert !defined?(::RaisesNameError), "::RaisesNameError is defined but it hasn't been referenced yet!"
@@ -714,7 +723,7 @@ class DependenciesTest < Test::Unit::TestCase
ensure
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
end
-
+
def test_remove_constant_handles_double_colon_at_start
Object.const_set 'DeleteMe', Module.new
DeleteMe.const_set 'OrMe', Module.new
@@ -724,7 +733,7 @@ class DependenciesTest < Test::Unit::TestCase
Dependencies.remove_constant "::DeleteMe"
assert ! defined?(DeleteMe)
end
-
+
def test_load_once_constants_should_not_be_unloaded
with_loading 'autoloading_fixtures' do
Dependencies.load_once_paths = Dependencies.load_paths
@@ -737,7 +746,7 @@ class DependenciesTest < Test::Unit::TestCase
Dependencies.load_once_paths = []
Object.class_eval { remove_const :A if const_defined?(:A) }
end
-
+
def test_load_once_paths_should_behave_when_recursively_loading
with_loading 'dependencies', 'autoloading_fixtures' do
Dependencies.load_once_paths = [Dependencies.load_paths.last]
@@ -753,5 +762,4 @@ class DependenciesTest < Test::Unit::TestCase
ensure
Dependencies.load_once_paths = []
end
-
end