Skip to content

Commit

Permalink
Merge pull request rails#22035 from yui-knk/update_doc_anonymous
Browse files Browse the repository at this point in the history
[ci skip] Add more code examples for `Module#anonymous?` docs
  • Loading branch information
senny committed Oct 23, 2015
2 parents b9d1e10 + f3de0c1 commit 2ad9afe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions activesupport/lib/active_support/core_ext/module/anonymous.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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
Expand Down

0 comments on commit 2ad9afe

Please sign in to comment.