Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine-installer/ext/string.rb

Instance Method Summary collapse

Instance Method Details

#camelizeObject

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

#underscoreObject



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