Sha256: f21faa790e45a9445228523a8a40d0e64f39a56f9d1061a421333f3b235038af
Contents?: true
Size: 483 Bytes
Versions: 5
Compression:
Stored size: 483 Bytes
Contents
# used from ActiveSupport # Copyright (c) 2005-2009 David Heinemeier Hansson class String def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end def camelize self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } end def humanize self.gsub(/_id$/, "").gsub(/_/, " ").capitalize end def blank? self == "" end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
roart-0.1.8 | lib/roart/core/string.rb |
roart-0.1.7 | lib/roart/core/string.rb |
roart-0.1.6 | lib/roart/core/string.rb |
roart-0.1.5.1 | lib/roart/core/string.rb |
roart-0.1.5 | lib/roart/core/string.rb |