From 92dce324b95678d142f8e1967a9ec16bf1efc250 Mon Sep 17 00:00:00 2001 From: Anton Davydov Date: Sat, 28 Feb 2015 20:46:21 +0300 Subject: [ci skip] Add code examples for Module#anonymous? documentation --- activesupport/lib/active_support/core_ext/module/anonymous.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/module/anonymous.rb b/activesupport/lib/active_support/core_ext/module/anonymous.rb index b0c7b021db..0ecc67a855 100644 --- a/activesupport/lib/active_support/core_ext/module/anonymous.rb +++ b/activesupport/lib/active_support/core_ext/module/anonymous.rb @@ -7,6 +7,13 @@ class Module # m = Module.new # m.name # => nil # + # +anonymous?+ method returns true if module does not have a name: + # + # Module.new.anonymous? # => true + # + # module M; end + # M.anonymous? # => false + # # A module gets a name when it is first assigned to a constant. Either # via the +module+ or +class+ keyword or by an explicit assignment: # -- cgit v1.2.3