Skip to content

Commit

Permalink
AS guide: s/metaclass/singleton_class/ due to 0b87d11
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Feb 25, 2010
1 parent 47683b7 commit 4dcc4a0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions railties/guides/source/active_support_core_extensions.textile
Expand Up @@ -138,16 +138,19 @@ end


NOTE: Defined in +active_support/core_ext/object/try.rb+. NOTE: Defined in +active_support/core_ext/object/try.rb+.


h4. +metaclass+ h4. +singleton_class+


The method +metaclass+ returns the singleton class on any object: The method +singleton_class+ returns the singleton class of the receiver:


<ruby> <ruby>
String.metaclass # => #<Class:String> String.singleton_class # => #<Class:String>
String.new.metaclass # => #<Class:#<String:0x17a1d1c>> String.new.singleton_class # => #<Class:#<String:0x17a1d1c>>
</ruby> </ruby>


NOTE: Defined in +active_support/core_ext/object/metaclass.rb+. WARNING: Fixnums and symbols have no singleton classes, +singleton_class+
raises +TypeError+ on them.

NOTE: Defined in +active_support/core_ext/object/singleton_class.rb+.


h4. +class_eval(*args, &block)+ h4. +class_eval(*args, &block)+


Expand All @@ -168,7 +171,7 @@ class Proc
end end
</ruby> </ruby>


NOTE: Defined in +active_support/core_ext/object/metaclass.rb+. NOTE: Defined in +active_support/core_ext/object/singleton_class.rb+.


h4. +acts_like?(duck)+ h4. +acts_like?(duck)+


Expand Down

0 comments on commit 4dcc4a0

Please sign in to comment.