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.12.1 lib/savon/core_ext/string.rb
savon-2.12.0 lib/savon/core_ext/string.rb
savon-2.11.2 lib/savon/core_ext/string.rb
savon-SU-2.11.1b lib/savon/core_ext/string.rb
savon-SU-2.11.1 lib/savon/core_ext/string.rb
savon-2.11.1 lib/savon/core_ext/string.rb
savon-2.11.0 lib/savon/core_ext/string.rb
savon-2.10.1 lib/savon/core_ext/string.rb
savon-2.10.0 lib/savon/core_ext/string.rb
savon-2.9.0 lib/savon/core_ext/string.rb
savon-2.8.1 lib/savon/core_ext/string.rb
savon-2.8.0 lib/savon/core_ext/string.rb
savon-2.7.2 lib/savon/core_ext/string.rb
savon-2.7.1 lib/savon/core_ext/string.rb
savon-2.7.0 lib/savon/core_ext/string.rb
savon-2.6.0 lib/savon/core_ext/string.rb
savon-2.5.1 lib/savon/core_ext/string.rb
savon-2.5.0 lib/savon/core_ext/string.rb
savon_with_adapter-2.4.1 lib/savon/core_ext/string.rb
savon-2.4.0 lib/savon/core_ext/string.rb