From 79829560137ab6ab2ff1db3e5fa1977f4790152e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 9 Nov 2009 23:38:48 +0100 Subject: AS guide: removes docs for Object#instance_variable_defined?, no longer in AS --- .../source/active_support_core_extensions.textile | 26 ---------------------- 1 file changed, 26 deletions(-) diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 4070d0a5c7..40ba47068d 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -297,32 +297,6 @@ h4. Instance Variables Active Support provides several methods to ease access to instance variables. -h5. +instance_variable_defined?+ - -The method +instance_variable_defined?+ exists in Ruby 1.8.6 and later, and it is defined for previous versions anyway: - - -class C - def initialize - @a = 1 - end - - def m - @b = 2 - end -end - -c = C.new - -c.instance_variable_defined?("@a") # => true -c.instance_variable_defined?(:@a) # => true -c.instance_variable_defined?("a") # => NameError: `a' is not allowed as an instance variable name - -c.instance_variable_defined?("@b") # => false -c.m -c.instance_variable_defined?("@b") # => true - - h5. +instance_variable_names+ Ruby 1.8 and 1.9 have a method called +instance_variables+ that returns the names of the defined instance variables. But they behave differently, in 1.8 it returns strings whereas in 1.9 it returns symbols. Active Support defines +instance_variable_names+ as a portable way to obtain them as strings: -- cgit v1.2.3