diff options
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/instance_variables.rb | 8 |
1 files changed, 6 insertions, 2 deletions
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 ee1010b250..9f1d4ed2aa 100644 --- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb +++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb @@ -33,8 +33,12 @@ class Object # 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+. |