Sha256: 00daf72a27de3653be0438dcb4a7881cd8d799f41454f608ec302b5c0a2e6308

Contents?: true

Size: 565 Bytes

Versions: 26

Compression:

Stored size: 565 Bytes

Contents

module Savon
  module CoreExt
    module String

      def self.included(base)
        unless "savon".respond_to?(:snakecase)
          base.send(:include, Extension)
        end
      end

      module Extension
        def snakecase
          str = dup
          str.gsub! /::/, '/'
          str.gsub! /([A-Z]+)([A-Z][a-z])/, '\1_\2'
          str.gsub! /([a-z\d])([A-Z])/, '\1_\2'
          str.tr! ".", "_"
          str.tr! "-", "_"
          str.downcase!
          str
        end
      end

    end
  end
end

String.send :include, Savon::CoreExt::String

Version data entries

26 entries across 26 versions & 4 rubygems

Version Path
savon-2.3.3 lib/savon/core_ext/string.rb
savon-2.3.2 lib/savon/core_ext/string.rb
savon-2.3.1 lib/savon/core_ext/string.rb
savon-ng-1.6-2.4.1 lib/savon/core_ext/string.rb
savon-ng-1.6-2.4.0 lib/savon/core_ext/string.rb
savon-2.3.0 lib/savon/core_ext/string.rb