Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/redmine-installer/ext/string.rb
Instance Method Summary collapse
-
#camelize ⇒ Object
Base on ActiveSupport method.
- #underscore ⇒ Object
Instance Method Details
#camelize ⇒ Object
Base on ActiveSupport method
4 5 6 |
# File 'lib/redmine-installer/ext/string.rb', line 4 def camelize self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } end |
#underscore ⇒ Object
10 11 12 13 |
# File 'lib/redmine-installer/ext/string.rb', line 10 def underscore self.gsub(/\A([A-Z])/){$1.downcase} .gsub(/([A-Z])/){'_'+$1.downcase} end |