Skip to content

Commit

Permalink
Alias Object#instance_variable_names to Object#instance_variables for…
Browse files Browse the repository at this point in the history
… Ruby 1.8.x
  • Loading branch information
lifo committed Apr 21, 2008
1 parent a04f022 commit 6dbe90d
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -33,8 +33,12 @@ def instance_values #:nodoc:
# end
#
# C.new(0, 1).instance_variable_names # => ["@y", "@x"]
def instance_variable_names
instance_variables.map(&:to_s)
if RUBY_VERSION >= '1.9'
def instance_variable_names
instance_variables.map(&:to_s)
end
else
alias_method :instance_variable_names, :instance_variables
end

# Copies the instance variables of +object+ into +self+.
Expand Down

0 comments on commit 6dbe90d

Please sign in to comment.