Sha256: ec25410c6199690ae5e0faa34be860f1be9fc1eb5a0db0986fc9402e8562482d
Contents?: true
Size: 343 Bytes
Versions: 2
Compression:
Stored size: 343 Bytes
Contents
# add the underscore from rails for snake_casing strings 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 snake_case self.gsub(" ", "_"). downcase end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openstudio-analysis-0.1.8 | lib/openstudio/helpers/string.rb |
openstudio-analysis-0.1.7 | lib/openstudio/helpers/string.rb |