Browse files

Use map, no need to use inject here.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent 7047d83 commit c88deaf5ee0a7abd767a770ebfbe9ab532b147de @miloops miloops committed with spastorino Sep 22, 2010
Showing with 1 addition and 4 deletions.
  1. +1 −4 activesupport/lib/active_support/core_ext/object/instance_variables.rb
View
5 activesupport/lib/active_support/core_ext/object/instance_variables.rb
@@ -10,10 +10,7 @@ class Object
#
# C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
def instance_values #:nodoc:
- instance_variables.inject({}) do |values, name|
- values[name.to_s[1..-1]] = instance_variable_get(name)
- values
- end
+ Hash[instance_variables.map { |name| [name.to_s[1..-1], instance_variable_get(name)] }]
end
# Returns an array of instance variable names including "@". They are strings

0 comments on commit c88deaf

Please sign in to comment.