Sha256: ceec8bb16a219ed9978a7e737edf5617b2bc7b2181ed541d8d97f3197f5bf5d7

Contents?: true

Size: 215 Bytes

Versions: 3

Compression:

Stored size: 215 Bytes

Contents

# frozen_string_literal: true

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

3 entries across 3 versions & 1 rubygems

Version Path
xmlhasher-1.0.7 lib/xmlhasher/util.rb
xmlhasher-1.0.6 lib/xmlhasher/util.rb
xmlhasher-1.0.5 lib/xmlhasher/util.rb