aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Nartimov <just.lest@gmail.com>2012-01-07 15:30:36 +0300
committerSergey Nartimov <just.lest@gmail.com>2012-01-07 15:30:36 +0300
commit5215eed5a3f18c76d70f0f25bca4ff6286c4bac8 (patch)
treee158ff18a6c76f1d585757f47339f5d4f1c23fb6
parent8c63e7d35db1f412f0d7c065e7191f99bda652e3 (diff)
downloadrails-5215eed5a3f18c76d70f0f25bca4ff6286c4bac8.tar.gz
rails-5215eed5a3f18c76d70f0f25bca4ff6286c4bac8.tar.bz2
rails-5215eed5a3f18c76d70f0f25bca4ff6286c4bac8.zip
Symbol#[] method presents in Ruby 1.9
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/object/instance_variables.rb2
-rw-r--r--activesupport/lib/active_support/string_inquirer.rb4
3 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 3619ef5cf5..ddc93464cd 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -121,7 +121,7 @@ module AbstractController
variables = instance_variables
variables -= protected_instance_variables
variables -= DEFAULT_PROTECTED_INSTANCE_VARIABLES
- variables.each { |name| hash[name.to_s[1, name.length]] = instance_variable_get(name) }
+ variables.each { |name| hash[name[1..-1]] = instance_variable_get(name) }
hash
end
diff --git a/activesupport/lib/active_support/core_ext/object/instance_variables.rb b/activesupport/lib/active_support/core_ext/object/instance_variables.rb
index 66caf9bec8..91fdf93eb2 100644
--- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb
+++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb
@@ -10,7 +10,7 @@ class Object
#
# C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
def instance_values #:nodoc:
- Hash[instance_variables.map { |name| [name.to_s[1..-1], instance_variable_get(name)] }]
+ Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }]
end
# Returns an array of instance variable names including "@". They are strings
diff --git a/activesupport/lib/active_support/string_inquirer.rb b/activesupport/lib/active_support/string_inquirer.rb
index e6b1f39225..f3f3909a90 100644
--- a/activesupport/lib/active_support/string_inquirer.rb
+++ b/activesupport/lib/active_support/string_inquirer.rb
@@ -11,8 +11,8 @@ module ActiveSupport
#
class StringInquirer < String
def method_missing(method_name, *arguments)
- if method_name.to_s[-1,1] == "?"
- self == method_name.to_s[0..-2]
+ if method_name[-1, 1] == "?"
+ self == method_name[0..-2]
else
super
end