Sha256: d4507dd4a4435e2660b0e0d3afec5558774119a25d7cea9b04fd9c2b503f144d

Contents?: true

Size: 505 Bytes

Versions: 106

Compression:

Stored size: 505 Bytes

Contents

class Module
  # Returns the class name of a full module namespace path
  #
  # @example
  #   module A::B::C; class_name end # => "C"
  # @return [String] the last part of a module path
  def class_name
    name.split("::").last
  end

  # Returns the module namespace path minus the class/module name
  #
  # @example
  #   module A::B::C; namespace_name end # => "A::B"
  # @return [String] the namespace minus the class/module name
  def namespace_name
    name.split("::")[0..-2].join("::")
  end
end

Version data entries

106 entries across 86 versions & 10 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/yard-0.9.2/lib/yard/core_ext/module.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.1/lib/yard/core_ext/module.rb
yard-0.9.5 lib/yard/core_ext/module.rb
yard-0.9.4 lib/yard/core_ext/module.rb
yard-0.9.3 lib/yard/core_ext/module.rb
yard-0.9.2 lib/yard/core_ext/module.rb
yard-0.9.1 lib/yard/core_ext/module.rb
yard-0.9.0 lib/yard/core_ext/module.rb
yard-0.8.7.6 lib/yard/core_ext/module.rb
yard-0.8.7.5 lib/yard/core_ext/module.rb
climine-0.0.7 vendor/bundle/ruby/2.1.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb
yard-0.8.7.4 lib/yard/core_ext/module.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/lib/yard/core_ext/module.rb