Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/fusuma/plugin/manager.rb
Overview
support camerize and underscore
Instance Method Summary collapse
Instance Method Details
#camerize ⇒ Object
105 106 107 108 109 110 |
# File 'lib/fusuma/plugin/manager.rb', line 105 def camerize split('_').map do |w| w[0].upcase! w end.join end |
#underscore ⇒ Object
112 113 114 115 116 117 118 |
# File 'lib/fusuma/plugin/manager.rb', line 112 def underscore gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .gsub('::', '/') .tr('-', '_') .downcase end |