Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/maveric/extensions.rb
Class Method Summary collapse
-
.nesting_path_to_constant(path) ⇒ Object
::nodoc::.
Instance Method Summary collapse
-
#nesting_path ⇒ Object
Build a string akin to the absolute path of the nesting structure.
Class Method Details
.nesting_path_to_constant(path) ⇒ Object
- ::nodoc
10 11 12 13 |
# File 'lib/maveric/extensions.rb', line 10 def self.nesting_path_to_constant path dig=proc{|c,n| c.const_get(n)} path.gsub(/_([a-z])/){$1.upcase}.split('/') end |
Instance Method Details
#nesting_path ⇒ Object
Build a string akin to the absolute path of the nesting structure.
3 4 5 6 7 8 |
# File 'lib/maveric/extensions.rb', line 3 def nesting_path ('::'+self.to_s). # '::' prepended for absolute path semantic gsub(/([a-z])([A-Z])/, '\1_\2'). gsub(/(::)+/, '/'). downcase end |