Sha256: c8e01278ff846e7169e38f027f69c63b59304a64b718932c752d5565d3e783bf

Contents?: true

Size: 184 Bytes

Versions: 8

Compression:

Stored size: 184 Bytes

Contents

module XmlHasher
  module Util
    def self.snakecase(str)
      str.to_s.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z])([A-Z])/, '\1_\2').downcase.tr('-', '_')
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
xmlhasher_with_attributes-1.0.1 lib/xmlhasher/util.rb
xmlhasher_with_attributes-1.0.0 lib/xmlhasher/util.rb
xmlhasher-1.0.4 lib/xmlhasher/util.rb
xmlhasher-1.0.3 lib/xmlhasher/util.rb
xmlhasher-1.0.2 lib/xmlhasher/util.rb
xmlhasher-1.0.1 lib/xmlhasher/util.rb
xmlhasher-1.0.0 lib/xmlhasher/util.rb
xmlhasher-0.0.6 lib/xmlhasher/util.rb