Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/antlr3/test/core-extensions.rb

Direct Known Subclasses

ANTLR3::Template::Group, ANTLR3::TokenScheme

Instance Method Summary collapse

Instance Method Details

#modspaceObject

Returns the module's container module.

module Example
  class Demo
  end
end

Example::Demo.modspace   #=> Example

See also Module#basename.

CREDIT: Trans

152
153
154
155
# File 'lib/antlr3/test/core-extensions.rb', line 152

def modspace
  space = name[ 0...( name.rindex( '::' ) || 0 ) ]
  space.empty? ? Object : eval( space )
end