Module: Waves::Ext::Module

Included in:
Module
Defined in:
lib/waves/ext/module.rb

Instance Method Summary collapse

Instance Method Details

#[](cname) ⇒ Object

Just a convenience method for dynamically referencing submodules. Note that you cannot do const_get, because that will also attempt to deref the cname at global scope. So it is more efficient to just use eval.



12
# File 'lib/waves/ext/module.rb', line 12

def []( cname ) ; eval( "self::#{cname.to_s.camel_case}" ) ; end

#basenameObject



5
# File 'lib/waves/ext/module.rb', line 5

def basename ; self.name.split('::').last || '' ; end

#rootObject



7
# File 'lib/waves/ext/module.rb', line 7

def root ; eval( "::#{self.rootname}" ) ; end

#rootnameObject



6
# File 'lib/waves/ext/module.rb', line 6

def rootname ; self.name.split('::').first ; end