Sha256: c97579ba35d9cce713b878141f539d17541a68422685a28a8fd32e67d1d88180
Contents?: true
Size: 592 Bytes
Versions: 2
Compression:
Stored size: 592 Bytes
Contents
class String #:nodoc: def titleize self.underscore.humanize.gsub(/\b([a-z])/) { $1.capitalize } end def humanize() self.gsub(/_id$/, "").gsub(/_/, " ").capitalize end def camelize(first_letter_in_uppercase = true) if first_letter_in_uppercase self.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } else self.first + self.camelize[1..-1] end end def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-processing-1.0.1 | lib/ruby-processing/helpers/string.rb |
ruby-processing-1.0.2 | lib/ruby-processing/helpers/string.rb |