diff options
author | yui-knk <spiketeika@gmail.com> | 2015-10-23 08:27:06 +0900 |
---|---|---|
committer | yui-knk <spiketeika@gmail.com> | 2015-10-23 13:25:19 +0900 |
commit | f3de0c185aae346cf9ffc0b0b327ee6fb0f8a67e (patch) | |
tree | f7c31f2046087be92d20ca5d8af1d6797e129dda /activesupport | |
parent | b9d1e101b4982dd9c9359b2824589c3783effa26 (diff) | |
download | rails-f3de0c185aae346cf9ffc0b0b327ee6fb0f8a67e.tar.gz rails-f3de0c185aae346cf9ffc0b0b327ee6fb0f8a67e.tar.bz2 rails-f3de0c185aae346cf9ffc0b0b327ee6fb0f8a67e.zip |
[ci skip] Add more code examples for `Module#anonymous?` docs
In later code examples, it is better to write how `Module#anonymous?`
works.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/anonymous.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/anonymous.rb b/activesupport/lib/active_support/core_ext/module/anonymous.rb index 0ecc67a855..510c9a5430 100644 --- a/activesupport/lib/active_support/core_ext/module/anonymous.rb +++ b/activesupport/lib/active_support/core_ext/module/anonymous.rb @@ -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 |