Class: Module
Overview
Monkey-patch Module Class
Instance Method Summary collapse
-
#mod_name ⇒ String
Module Name: Returns the name of the Module, without its hierarchical tree.
-
#mod_parent ⇒ Object
Parent: Returns the Module’s immediate parent.
-
#mod_parent_name ⇒ Object
Parent Name: Returns the Module’s immediate parent’s name.
Instance Method Details
#mod_name ⇒ String
Module Name: Returns the name of the Module, without its hierarchical tree.
10 11 12 |
# File 'lib/aromat/module.rb', line 10 def mod_name name[/[^:]+$/] end |
#mod_parent ⇒ Object
Parent: Returns the Module’s immediate parent.
22 23 24 25 |
# File 'lib/aromat/module.rb', line 22 def mod_parent n = mod_parent_name (n == '') ? nil : const_get(n) end |
#mod_parent_name ⇒ Object
Parent Name: Returns the Module’s immediate parent’s name.
16 17 18 |
# File 'lib/aromat/module.rb', line 16 def mod_parent_name name.index('::') ? name.gsub(/::#{mod_name}$/, '') : '' end |