Sha256: 124b50f7ce05ddbfa7cff261491882e6446116523e57c8335cd6a40d5304d706

Contents?: true

Size: 248 Bytes

Versions: 3

Compression:

Stored size: 248 Bytes

Contents

class String
  # Don't really like patching string here,
  # but it's fine for now.
  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

3 entries across 3 versions & 1 rubygems

Version Path
spigot-0.2.2 lib/spigot/patch.rb
spigot-0.2.1 lib/spigot/patch.rb
spigot-0.2.0 lib/spigot/patch.rb