Sha256: 0126b210970eb2408871d126cfaaa44b97c99dde8ca3a56ec5ee1324a252d843
Contents?: true
Size: 912 Bytes
Versions: 3
Compression:
Stored size: 912 Bytes
Contents
require "savon" require "savon/model" module Savon module SOAP class Response # Returns the +original_hash+ def new_hash @new_hash ||= response_pattern original_hash end alias_method :original_hash, :to_hash alias_method :to_hash, :new_hash def to_array @array ||= begin array = to_hash.kind_of?(Array) ? to_hash : [to_hash] array.compact end end private def response_pattern(hash) return hash if Model.response_pattern.blank? Model.response_pattern.inject(hash) do |memo, pattern| key = case pattern when Regexp then memo.keys.find { |key| key.to_s =~ pattern } else memo.keys.find { |key| key.to_s == pattern.to_s } end return unless key memo[key] end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
savon_model-0.1.2 | lib/savon/ext/response.rb |
savon_model-0.1.1 | lib/savon/ext/response.rb |
savon_model-0.1.0 | lib/savon/ext/response.rb |