diff --git a/activesupport/lib/active_support/core_ext/module/anonymous.rb b/activesupport/lib/active_support/core_ext/module/anonymous.rb index 3982c9c586205544cc78e082a74bf1b4639c4e6a..0a9e79103052a17633ea404f9a529241b5954bf7 100644 --- a/activesupport/lib/active_support/core_ext/module/anonymous.rb +++ b/activesupport/lib/active_support/core_ext/module/anonymous.rb @@ -1,5 +1,3 @@ -require 'active_support/core_ext/object/blank' - class Module # A module may or may not have a name. # @@ -7,7 +5,7 @@ class Module # M.name # => "M" # # m = Module.new - # m.name # => "" + # m.name # => nil # # 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: @@ -17,8 +15,6 @@ class Module # m.name # => "M" # def anonymous? - # Uses blank? because the name of an anonymous class is an empty - # string in 1.8, and nil in 1.9. - name.blank? + name.nil? end end diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index e912de974ae17c7a70db396c248428847bb78258..7cd241f412772b31da838fa76cccb2664b1a5a7f 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -822,7 +822,7 @@ M.name # => "M" N = Module.new N.name # => "N" -Module.new.name # => "" in 1.8, nil in 1.9 +Module.new.name # => nil You can check whether a module has a name with the predicate +anonymous?+: