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
lazy_record-0.1.8 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.1.7 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.1.6 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.1.4 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
tdiary-5.0.4 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.0.rc1 lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.1.3 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.1.2 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.1.1 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
lazy_record-0.1.0 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/module/anonymous.rb
activesupport-5.0.2 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.0.2.rc1 lib/active_support/core_ext/module/anonymous.rb
activesupport-5.1.0.beta1 lib/active_support/core_ext/module/anonymous.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1/lib/active_support/core_ext/module/anonymous.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1/lib/active_support/core_ext/module/anonymous.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1/lib/active_support/core_ext/module/anonymous.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1/lib/active_support/core_ext/module/anonymous.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1/lib/active_support/core_ext/module/anonymous.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1/lib/active_support/core_ext/module/anonymous.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.1/lib/active_support/core_ext/module/anonymous.rb