Sha256: 109298a586ce9a659be1f48f515390e3662bc362cb035ae9ef89925c7a68007c

Contents?: true

Size: 275 Bytes

Versions: 7

Compression:

Stored size: 275 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
end
                     

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openstudio-analysis-0.1.6 lib/openstudio/helpers/string.rb
openstudio-analysis-0.1.5 lib/openstudio/helpers/string.rb
openstudio-analysis-0.1.4 lib/openstudio/helpers/string.rb
openstudio-analysis-0.1.3 lib/openstudio/helpers/string.rb
openstudio-analysis-0.1.2 lib/openstudio/helpers/string.rb
openstudio-analysis-0.1.1 lib/openstudio/helpers/string.rb
openstudio-analysis-0.1 lib/openstudio/helpers/string.rb