Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/yard/core_ext/module.rb

Instance Method Summary collapse

Instance Method Details

#class_nameString

Returns the class name of a full module namespace path

Examples:

module A::B::C; class_name end # => "C"

Returns:

  • (String)

    the last part of a module path



7
8
9
# File 'lib/yard/core_ext/module.rb', line 7

def class_name
  name.split("::").last
end

#namespace_nameString

Returns the module namespace path minus the class/module name

Examples:

module A::B::C; namespace_name end # => "A::B"

Returns:

  • (String)

    the namespace minus the class/module name



16
17
18
# File 'lib/yard/core_ext/module.rb', line 16

def namespace_name
  name.split("::")[0..-2].join("::")
end