aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-10-02 05:32:14 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-10-02 05:32:14 +0000
commit0ee1cb2cd32bfaf47deaf5440dd5b9cf0915ab6a (patch)
tree5778378eafcbdfa37c82c67be1566c76aca249be /activesupport
parent9264bdc8f618344307f07790a07a60dc04b80434 (diff)
downloadrails-0ee1cb2cd32bfaf47deaf5440dd5b9cf0915ab6a.tar.gz
rails-0ee1cb2cd32bfaf47deaf5440dd5b9cf0915ab6a.tar.bz2
rails-0ee1cb2cd32bfaf47deaf5440dd5b9cf0915ab6a.zip
Ruby 1.9 compat, consistent load paths
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7719 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/clean_logger.rb2
-rw-r--r--activesupport/lib/active_support/core_ext.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/array.rb8
-rw-r--r--activesupport/lib/active_support/core_ext/bigdecimal.rb3
-rw-r--r--activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb (renamed from activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb)3
-rw-r--r--activesupport/lib/active_support/core_ext/cgi.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/class.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/date.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/date_time.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/float.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/hash.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/integer.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/kernel.rb10
-rw-r--r--activesupport/lib/active_support/core_ext/module.rb16
-rw-r--r--activesupport/lib/active_support/core_ext/numeric.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/object.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/pathname.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/range.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/string.rb12
-rw-r--r--activesupport/lib/active_support/core_ext/test.rb3
-rw-r--r--activesupport/lib/active_support/core_ext/test/unit/assertions.rb (renamed from activesupport/lib/active_support/core_ext/test/difference.rb)0
-rw-r--r--activesupport/lib/active_support/core_ext/time.rb6
-rw-r--r--activesupport/lib/active_support/dependencies.rb6
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb6
-rw-r--r--activesupport/test/inflector_test.rb10
25 files changed, 70 insertions, 64 deletions
diff --git a/activesupport/lib/active_support/clean_logger.rb b/activesupport/lib/active_support/clean_logger.rb
index 0c6de67f8d..b4c27ebc9d 100644
--- a/activesupport/lib/active_support/clean_logger.rb
+++ b/activesupport/lib/active_support/clean_logger.rb
@@ -1,5 +1,5 @@
require 'logger'
-require File.dirname(__FILE__) + '/core_ext/class/attribute_accessors'
+require 'active_support/core_ext/class/attribute_accessors'
# Extensions to the built in Ruby logger.
#
diff --git a/activesupport/lib/active_support/core_ext.rb b/activesupport/lib/active_support/core_ext.rb
index cb43160bda..4deef8c7a5 100644
--- a/activesupport/lib/active_support/core_ext.rb
+++ b/activesupport/lib/active_support/core_ext.rb
@@ -1 +1,4 @@
-Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].sort.each { |file| require(file) }
+Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].sort.each do |path|
+ filename = File.basename(path)
+ require "active_support/core_ext/#{filename}"
+end
diff --git a/activesupport/lib/active_support/core_ext/array.rb b/activesupport/lib/active_support/core_ext/array.rb
index 1d18900bab..4c973488a5 100644
--- a/activesupport/lib/active_support/core_ext/array.rb
+++ b/activesupport/lib/active_support/core_ext/array.rb
@@ -1,7 +1,7 @@
-require File.dirname(__FILE__) + '/array/conversions'
-require File.dirname(__FILE__) + '/array/extract_options'
-require File.dirname(__FILE__) + '/array/grouping'
-require File.dirname(__FILE__) + '/array/random_access'
+require 'active_support/core_ext/array/conversions'
+require 'active_support/core_ext/array/extract_options'
+require 'active_support/core_ext/array/grouping'
+require 'active_support/core_ext/array/random_access'
class Array #:nodoc:
include ActiveSupport::CoreExtensions::Array::Conversions
diff --git a/activesupport/lib/active_support/core_ext/bigdecimal.rb b/activesupport/lib/active_support/core_ext/bigdecimal.rb
index 436b3e000f..b442ae9655 100644
--- a/activesupport/lib/active_support/core_ext/bigdecimal.rb
+++ b/activesupport/lib/active_support/core_ext/bigdecimal.rb
@@ -1,3 +1,2 @@
require 'bigdecimal'
-
-require File.dirname(__FILE__) + '/bigdecimal/formatting.rb'
+require 'active_support/core_ext/bigdecimal/conversions'
diff --git a/activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb b/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb
index d86adbea6c..dcdb08aea0 100644
--- a/activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb
+++ b/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb
@@ -1,7 +1,6 @@
class BigDecimal #:nodoc:
-
alias :_original_to_s :to_s
def to_s(format="F")
_original_to_s(format)
end
-end \ No newline at end of file
+end
diff --git a/activesupport/lib/active_support/core_ext/cgi.rb b/activesupport/lib/active_support/core_ext/cgi.rb
index 072a7c99d2..db90e5c745 100644
--- a/activesupport/lib/active_support/core_ext/cgi.rb
+++ b/activesupport/lib/active_support/core_ext/cgi.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/cgi/escape_skipping_slashes'
+require 'active_support/core_ext/cgi/escape_skipping_slashes'
class CGI #:nodoc:
- extend(ActiveSupport::CoreExtensions::CGI::EscapeSkippingSlashes)
+ extend ActiveSupport::CoreExtensions::CGI::EscapeSkippingSlashes
end
diff --git a/activesupport/lib/active_support/core_ext/class.rb b/activesupport/lib/active_support/core_ext/class.rb
index 7bacdb3903..83eb8135f4 100644
--- a/activesupport/lib/active_support/core_ext/class.rb
+++ b/activesupport/lib/active_support/core_ext/class.rb
@@ -1,3 +1,3 @@
-require File.dirname(__FILE__) + '/class/attribute_accessors'
-require File.dirname(__FILE__) + '/class/inheritable_attributes'
-require File.dirname(__FILE__) + '/class/removal' \ No newline at end of file
+require 'active_support/core_ext/class/attribute_accessors'
+require 'active_support/core_ext/class/inheritable_attributes'
+require 'active_support/core_ext/class/removal'
diff --git a/activesupport/lib/active_support/core_ext/date.rb b/activesupport/lib/active_support/core_ext/date.rb
index 9d9051dfbe..3f56c560b6 100644
--- a/activesupport/lib/active_support/core_ext/date.rb
+++ b/activesupport/lib/active_support/core_ext/date.rb
@@ -1,7 +1,7 @@
require 'date'
-require File.dirname(__FILE__) + '/date/behavior'
-require File.dirname(__FILE__) + '/date/calculations'
-require File.dirname(__FILE__) + '/date/conversions'
+require 'active_support/core_ext/date/behavior'
+require 'active_support/core_ext/date/calculations'
+require 'active_support/core_ext/date/conversions'
class Date#:nodoc:
include ActiveSupport::CoreExtensions::Date::Behavior
diff --git a/activesupport/lib/active_support/core_ext/date_time.rb b/activesupport/lib/active_support/core_ext/date_time.rb
index 7ce1b78090..1d711de70b 100644
--- a/activesupport/lib/active_support/core_ext/date_time.rb
+++ b/activesupport/lib/active_support/core_ext/date_time.rb
@@ -1,7 +1,7 @@
require 'date'
-require "#{File.dirname(__FILE__)}/time/behavior"
-require "#{File.dirname(__FILE__)}/date_time/calculations"
-require "#{File.dirname(__FILE__)}/date_time/conversions"
+require 'active_support/core_ext/time/behavior'
+require 'active_support/core_ext/date_time/calculations'
+require 'active_support/core_ext/date_time/conversions'
class DateTime
include ActiveSupport::CoreExtensions::Time::Behavior
diff --git a/activesupport/lib/active_support/core_ext/float.rb b/activesupport/lib/active_support/core_ext/float.rb
index ac5d5a47e6..86862b7150 100644
--- a/activesupport/lib/active_support/core_ext/float.rb
+++ b/activesupport/lib/active_support/core_ext/float.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/float/rounding'
+require 'active_support/core_ext/float/rounding'
class Float #:nodoc:
include ActiveSupport::CoreExtensions::Float::Rounding
diff --git a/activesupport/lib/active_support/core_ext/hash.rb b/activesupport/lib/active_support/core_ext/hash.rb
index b805d2da62..6cbd9dd378 100644
--- a/activesupport/lib/active_support/core_ext/hash.rb
+++ b/activesupport/lib/active_support/core_ext/hash.rb
@@ -1,5 +1,5 @@
%w(keys indifferent_access reverse_merge conversions diff slice except).each do |ext|
- require "#{File.dirname(__FILE__)}/hash/#{ext}"
+ require "active_support/core_ext/hash/#{ext}"
end
class Hash #:nodoc:
diff --git a/activesupport/lib/active_support/core_ext/integer.rb b/activesupport/lib/active_support/core_ext/integer.rb
index 9346b88fd5..d1e6d76acb 100644
--- a/activesupport/lib/active_support/core_ext/integer.rb
+++ b/activesupport/lib/active_support/core_ext/integer.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/integer/even_odd'
-require File.dirname(__FILE__) + '/integer/inflections'
+require 'active_support/core_ext/integer/even_odd'
+require 'active_support/core_ext/integer/inflections'
class Integer #:nodoc:
include ActiveSupport::CoreExtensions::Integer::EvenOdd
diff --git a/activesupport/lib/active_support/core_ext/kernel.rb b/activesupport/lib/active_support/core_ext/kernel.rb
index 6475be7efa..1922d804bf 100644
--- a/activesupport/lib/active_support/core_ext/kernel.rb
+++ b/activesupport/lib/active_support/core_ext/kernel.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/kernel/daemonizing'
-require File.dirname(__FILE__) + '/kernel/reporting'
-require File.dirname(__FILE__) + '/kernel/agnostics'
-require File.dirname(__FILE__) + '/kernel/requires'
-require File.dirname(__FILE__) + '/kernel/debugger'
+require 'active_support/core_ext/kernel/daemonizing'
+require 'active_support/core_ext/kernel/reporting'
+require 'active_support/core_ext/kernel/agnostics'
+require 'active_support/core_ext/kernel/requires'
+require 'active_support/core_ext/kernel/debugger'
diff --git a/activesupport/lib/active_support/core_ext/module.rb b/activesupport/lib/active_support/core_ext/module.rb
index 26c9bdf778..da8d5b3762 100644
--- a/activesupport/lib/active_support/core_ext/module.rb
+++ b/activesupport/lib/active_support/core_ext/module.rb
@@ -1,8 +1,8 @@
-require File.dirname(__FILE__) + '/module/inclusion'
-require File.dirname(__FILE__) + '/module/attribute_accessors'
-require File.dirname(__FILE__) + '/module/attr_internal'
-require File.dirname(__FILE__) + '/module/attr_accessor_with_default'
-require File.dirname(__FILE__) + '/module/delegation'
-require File.dirname(__FILE__) + '/module/introspection'
-require File.dirname(__FILE__) + '/module/loading'
-require File.dirname(__FILE__) + '/module/aliasing'
+require 'active_support/core_ext/module/inclusion'
+require 'active_support/core_ext/module/attribute_accessors'
+require 'active_support/core_ext/module/attr_internal'
+require 'active_support/core_ext/module/attr_accessor_with_default'
+require 'active_support/core_ext/module/delegation'
+require 'active_support/core_ext/module/introspection'
+require 'active_support/core_ext/module/loading'
+require 'active_support/core_ext/module/aliasing'
diff --git a/activesupport/lib/active_support/core_ext/numeric.rb b/activesupport/lib/active_support/core_ext/numeric.rb
index 88fead7aa4..59da205b3d 100644
--- a/activesupport/lib/active_support/core_ext/numeric.rb
+++ b/activesupport/lib/active_support/core_ext/numeric.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/numeric/time'
-require File.dirname(__FILE__) + '/numeric/bytes'
+require 'active_support/core_ext/numeric/time'
+require 'active_support/core_ext/numeric/bytes'
class Numeric #:nodoc:
include ActiveSupport::CoreExtensions::Numeric::Time
diff --git a/activesupport/lib/active_support/core_ext/object.rb b/activesupport/lib/active_support/core_ext/object.rb
index 57238f38f5..3b055d3185 100644
--- a/activesupport/lib/active_support/core_ext/object.rb
+++ b/activesupport/lib/active_support/core_ext/object.rb
@@ -1,3 +1,3 @@
-require File.dirname(__FILE__) + '/object/extending'
-require File.dirname(__FILE__) + '/object/instance_variables'
-require File.dirname(__FILE__) + '/object/misc'
+require 'active_support/core_ext/object/extending'
+require 'active_support/core_ext/object/instance_variables'
+require 'active_support/core_ext/object/misc'
diff --git a/activesupport/lib/active_support/core_ext/pathname.rb b/activesupport/lib/active_support/core_ext/pathname.rb
index 9e78c273d9..4c5318ee63 100644
--- a/activesupport/lib/active_support/core_ext/pathname.rb
+++ b/activesupport/lib/active_support/core_ext/pathname.rb
@@ -1,5 +1,5 @@
require 'pathname'
-require File.dirname(__FILE__) + '/pathname/clean_within'
+require 'active_support/core_ext/pathname/clean_within'
class Pathname#:nodoc:
extend ActiveSupport::CoreExtensions::Pathname::CleanWithin
diff --git a/activesupport/lib/active_support/core_ext/range.rb b/activesupport/lib/active_support/core_ext/range.rb
index ca77511521..ee7868a2f8 100644
--- a/activesupport/lib/active_support/core_ext/range.rb
+++ b/activesupport/lib/active_support/core_ext/range.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/range/conversions'
+require 'active_support/core_ext/range/conversions'
class Range #:nodoc:
include ActiveSupport::CoreExtensions::Range::Conversions
diff --git a/activesupport/lib/active_support/core_ext/string.rb b/activesupport/lib/active_support/core_ext/string.rb
index ef2f334fe2..724b2af2ee 100644
--- a/activesupport/lib/active_support/core_ext/string.rb
+++ b/activesupport/lib/active_support/core_ext/string.rb
@@ -1,9 +1,9 @@
-require File.dirname(__FILE__) + '/string/inflections'
-require File.dirname(__FILE__) + '/string/conversions'
-require File.dirname(__FILE__) + '/string/access'
-require File.dirname(__FILE__) + '/string/starts_ends_with'
-require File.dirname(__FILE__) + '/string/iterators' unless 'test'.respond_to?(:each_char)
-require File.dirname(__FILE__) + '/string/unicode'
+require 'active_support/core_ext/string/inflections'
+require 'active_support/core_ext/string/conversions'
+require 'active_support/core_ext/string/access'
+require 'active_support/core_ext/string/starts_ends_with'
+require 'active_support/core_ext/string/iterators' unless 'test'.respond_to?(:each_char)
+require 'active_support/core_ext/string/unicode'
class String #:nodoc:
include ActiveSupport::CoreExtensions::String::Access
diff --git a/activesupport/lib/active_support/core_ext/test.rb b/activesupport/lib/active_support/core_ext/test.rb
index 193599b8dc..c0b19bdc58 100644
--- a/activesupport/lib/active_support/core_ext/test.rb
+++ b/activesupport/lib/active_support/core_ext/test.rb
@@ -1,2 +1 @@
-require File.dirname(__FILE__) + '/test/difference'
-
+require 'active_support/core_ext/test/unit/assertions'
diff --git a/activesupport/lib/active_support/core_ext/test/difference.rb b/activesupport/lib/active_support/core_ext/test/unit/assertions.rb
index 2ae4b7d6d1..2ae4b7d6d1 100644
--- a/activesupport/lib/active_support/core_ext/test/difference.rb
+++ b/activesupport/lib/active_support/core_ext/test/unit/assertions.rb
diff --git a/activesupport/lib/active_support/core_ext/time.rb b/activesupport/lib/active_support/core_ext/time.rb
index a9e6a4385c..d87c4ec65a 100644
--- a/activesupport/lib/active_support/core_ext/time.rb
+++ b/activesupport/lib/active_support/core_ext/time.rb
@@ -8,9 +8,9 @@ class Time
end
end
-require File.dirname(__FILE__) + '/time/behavior'
-require File.dirname(__FILE__) + '/time/calculations'
-require File.dirname(__FILE__) + '/time/conversions'
+require 'active_support/core_ext/time/behavior'
+require 'active_support/core_ext/time/calculations'
+require 'active_support/core_ext/time/conversions'
class Time#:nodoc:
include ActiveSupport::CoreExtensions::Time::Behavior
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 9a2c933ab5..823e6040a9 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -1,7 +1,7 @@
require 'set'
-require File.dirname(__FILE__) + '/core_ext/module/attribute_accessors'
-require File.dirname(__FILE__) + '/core_ext/load_error'
-require File.dirname(__FILE__) + '/core_ext/kernel'
+require 'active_support/core_ext/module/attribute_accessors'
+require 'active_support/core_ext/load_error'
+require 'active_support/core_ext/kernel'
module Dependencies #:nodoc:
extend self
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index d4e72014ff..5691ec7c1c 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -63,9 +63,9 @@ class HashExtTest < Test::Unit::TestCase
hashes.each do |name, hash|
method_map.sort_by { |m| m.to_s }.each do |meth, expected|
- assert_equal(expected, hash.send(meth, 'a'),
+ assert_equal(expected, hash.send!(meth, 'a'),
"Calling #{name}.#{meth} 'a'")
- assert_equal(expected, hash.send(meth, :a),
+ assert_equal(expected, hash.send!(meth, :a),
"Calling #{name}.#{meth} :a")
end
end
@@ -640,7 +640,7 @@ class HashToXmlTest < Test::Unit::TestCase
def test_empty_string_works_for_typecast_xml_value
assert_nothing_raised do
- Hash.send(:typecast_xml_value, "")
+ Hash.send!(:typecast_xml_value, "")
end
end
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index 16ee50f8fb..b0155d36bc 100644
--- a/activesupport/test/inflector_test.rb
+++ b/activesupport/test/inflector_test.rb
@@ -120,8 +120,14 @@ class InflectorTest < Test::Unit::TestCase
assert_raises(NameError) { Inflector.constantize("InvalidClass\n") }
end
- def test_constantize_doesnt_look_in_parent
- assert_raises(NameError) { Inflector.constantize("Ace::Base::InflectorTest") }
+ if RUBY_VERSION < '1.9.0'
+ def test_constantize_does_lexical_lookup
+ assert_raises(NameError) { Inflector.constantize("Ace::Base::InflectorTest") }
+ end
+ else
+ def test_constantize_does_dynamic_lookup
+ assert_equal self.class, Inflector.constantize("Ace::Base::InflectorTest")
+ end
end
def test_ordinal