Skip to content

Commit 5215eed

Browse files
committed
Symbol#[] method presents in Ruby 1.9
1 parent 8c63e7d commit 5215eed

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

actionpack/lib/abstract_controller/rendering.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def view_assigns
121121
variables = instance_variables
122122
variables -= protected_instance_variables
123123
variables -= DEFAULT_PROTECTED_INSTANCE_VARIABLES
124-
variables.each { |name| hash[name.to_s[1, name.length]] = instance_variable_get(name) }
124+
variables.each { |name| hash[name[1..-1]] = instance_variable_get(name) }
125125
hash
126126
end
127127

activesupport/lib/active_support/core_ext/object/instance_variables.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Object
1010
#
1111
# C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
1212
def instance_values #:nodoc:
13-
Hash[instance_variables.map { |name| [name.to_s[1..-1], instance_variable_get(name)] }]
13+
Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }]
1414
end
1515

1616
# Returns an array of instance variable names including "@". They are strings

activesupport/lib/active_support/string_inquirer.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ module ActiveSupport
1111
#
1212
class StringInquirer < String
1313
def method_missing(method_name, *arguments)
14-
if method_name.to_s[-1,1] == "?"
15-
self == method_name.to_s[0..-2]
14+
if method_name[-1, 1] == "?"
15+
self == method_name[0..-2]
1616
else
1717
super
1818
end

0 commit comments

Comments
 (0)