From 5215eed5a3f18c76d70f0f25bca4ff6286c4bac8 Mon Sep 17 00:00:00 2001 From: Sergey Nartimov Date: Sat, 7 Jan 2012 15:30:36 +0300 Subject: Symbol#[] method presents in Ruby 1.9 --- .../lib/active_support/core_ext/object/instance_variables.rb | 2 +- activesupport/lib/active_support/string_inquirer.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activesupport/lib/active_support') 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 -- cgit v1.2.3