Sha256: 61fd441ba8df253013c192829a45d4a739f1c02e27524618c0882540bc50cfb8

Contents?: true

Size: 642 Bytes

Versions: 11

Compression:

Stored size: 642 Bytes

Contents

require 'active_support/core_ext/object/blank'

class Module
  # A module may or may not have a name.
  #
  #   module M; end
  #   M.name # => "M"
  #
  #   m = Module.new
  #   m.name # => ""
  #
  # 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:
  #
  #   m = Module.new # creates an anonymous module
  #   M = m          # => m gets a name here as a side-effect
  #   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? 
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
activesupport-3.0.0.rc lib/active_support/core_ext/module/anonymous.rb
csd-0.1.5 lib/active_support/core_ext/module/anonymous.rb
csd-0.1.4 lib/active_support/core_ext/module/anonymous.rb
csd-0.1.3 lib/active_support/core_ext/module/anonymous.rb
csd-0.1.2 lib/active_support/core_ext/module/anonymous.rb
csd-0.1.1 lib/active_support/core_ext/module/anonymous.rb
csd-0.1.0 lib/active_support/core_ext/module/anonymous.rb
csd-0.0.16 lib/active_support/core_ext/module/anonymous.rb
activesupport-3.0.0.beta4 lib/active_support/core_ext/module/anonymous.rb
activesupport-3.0.0.beta3 lib/active_support/core_ext/module/anonymous.rb
activesupport-3.0.0.beta2 lib/active_support/core_ext/module/anonymous.rb