1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] Add more code examples for Module#anonymous? docs

In later code examples, it is better to write how `Module#anonymous?`
works.
This commit is contained in:
yui-knk 2015-10-23 08:27:06 +09:00
parent b9d1e101b4
commit f3de0c185a

View file

@ -7,7 +7,7 @@ class Module
# m = Module.new
# m.name # => nil
#
# +anonymous?+ method returns true if module does not have a name:
# +anonymous?+ method returns true if module does not have a name, false otherwise:
#
# Module.new.anonymous? # => true
#
@ -18,8 +18,10 @@ class Module
# via the +module+ or +class+ keyword or by an explicit assignment:
#
# m = Module.new # creates an anonymous module
# M = m # => m gets a name here as a side-effect
# m.anonymous? # => true
# M = m # m gets a name here as a side-effect
# m.name # => "M"
# m.anonymous? # => false
def anonymous?
name.nil?
end