aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-07-22 01:29:18 +0200
committerXavier Noria <fxn@hashref.com>2010-07-22 01:29:18 +0200
commit919eb200a9a0969c444b938d08eb4661d41ba986 (patch)
tree329cbe815d549275cc0dc6aa0f75c18d8954f105 /activesupport/lib/active_support/core_ext
parent56669ec3048de316918ec5ad554fff83d757911b (diff)
parentb456877cfb7e0cb0bab9ffd5674abd23caba0ab4 (diff)
downloadrails-919eb200a9a0969c444b938d08eb4661d41ba986.tar.gz
rails-919eb200a9a0969c444b938d08eb4661d41ba986.tar.bz2
rails-919eb200a9a0969c444b938d08eb4661d41ba986.zip
Merge remote branch 'rails/master'
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/module/attribute_accessors.rb8
-rw-r--r--activesupport/lib/active_support/core_ext/module/remove_method.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/object/to_param.rb2
3 files changed, 7 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
index 9c4d5fae26..2d88cb57e5 100644
--- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
+++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
@@ -5,9 +5,7 @@ class Module
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- unless defined? @@#{sym}
- @@#{sym} = nil
- end
+ @@#{sym} = nil unless defined? @@#{sym}
def self.#{sym}
@@#{sym}
@@ -28,10 +26,6 @@ class Module
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- unless defined? @@#{sym}
- @@#{sym} = nil
- end
-
def self.#{sym}=(obj)
@@#{sym} = obj
end
diff --git a/activesupport/lib/active_support/core_ext/module/remove_method.rb b/activesupport/lib/active_support/core_ext/module/remove_method.rb
index 2714a46b28..b8c01aca0e 100644
--- a/activesupport/lib/active_support/core_ext/module/remove_method.rb
+++ b/activesupport/lib/active_support/core_ext/module/remove_method.rb
@@ -3,4 +3,9 @@ class Module
remove_method(method)
rescue NameError
end
+
+ def redefine_method(method, &block)
+ remove_possible_method(method)
+ define_method(method, &block)
+ end
end \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/object/to_param.rb b/activesupport/lib/active_support/core_ext/object/to_param.rb
index 06f077e920..f2e7c2351e 100644
--- a/activesupport/lib/active_support/core_ext/object/to_param.rb
+++ b/activesupport/lib/active_support/core_ext/object/to_param.rb
@@ -44,6 +44,6 @@ class Hash
def to_param(namespace = nil)
collect do |key, value|
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
- end.sort * '&'
+ end * '&'
end
end