Sha256: 36c1ae14d4d88437ffa4358b993f9a68a33f4b84be7735326f9d4d8e0b1869ce

Contents?: true

Size: 737 Bytes

Versions: 82

Compression:

Stored size: 737 Bytes

Contents

class Module
  # A module may or may not have a name.
  #
  #   module M; end
  #   M.name # => "M"
  #
  #   m = Module.new
  #   m.name # => nil
  #
  # +anonymous?+ method returns true if module does not have a name, false otherwise:
  #
  #   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:
  #
  #   m = Module.new # creates an anonymous module
  #   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
end

Version data entries

82 entries across 79 versions & 11 rubygems

Version Path
activesupport-5.0.5 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.0.5.rc2 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.3.rc2 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.0.5.rc1 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.3.rc1 lib/active_support/core_ext/module/anonymous.rb
tdiary-5.0.5 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
tdiary-5.0.5 vendor/bundle/gems/activesupport-5.1.2/lib/active_support/core_ext/module/anonymous.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.2 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.2.rc1 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.0.4 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.0.4.rc1 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.1 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.0.3 lib/active_support/core_ext/module/anonymous.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.0 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.0.rc2 lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.2.1 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.2.0 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.1.9 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb