diff options
author | Xavier Noria <fxn@hashref.com> | 2009-11-09 23:38:48 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2009-11-09 23:38:48 +0100 |
commit | 79829560137ab6ab2ff1db3e5fa1977f4790152e (patch) | |
tree | 7b30a6db4513f0dc8472187e1898641243ff0905 /railties/guides/source/active_support_core_extensions.textile | |
parent | b5faacb1946b303ba11fd67a475afbc419575aa5 (diff) | |
download | rails-79829560137ab6ab2ff1db3e5fa1977f4790152e.tar.gz rails-79829560137ab6ab2ff1db3e5fa1977f4790152e.tar.bz2 rails-79829560137ab6ab2ff1db3e5fa1977f4790152e.zip |
AS guide: removes docs for Object#instance_variable_defined?, no longer in AS
Diffstat (limited to 'railties/guides/source/active_support_core_extensions.textile')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 26 |
1 files changed, 0 insertions, 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: - -<ruby> -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 -</ruby> - 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: |