module Celsius::Primo::SoapApi::Searcher::SearchBrief::SearchResultTransformation::OxHelpers
Public Class Methods
hash_from_ox_element(ox_element)
click to toggle source
# File lib/celsius/primo/soap_api/searcher/search_brief/search_result_transformation.rb, line 33 def self.hash_from_ox_element(ox_element) if string_element?(ox_element) ox_element.first.force_encoding("utf-8") else ox_element.nodes.inject({}) do |hash, node| key = node.value if hash[key].is_a?(String) hash[key] = [hash[key]] end if hash[key].is_a?(Array) hash[key] << hash_from_ox_element(node.nodes) else hash[key] = hash_from_ox_element(node.nodes) end hash end end end
string_element?(ox_element)
click to toggle source
# File lib/celsius/primo/soap_api/searcher/search_brief/search_result_transformation.rb, line 55 def self.string_element?(ox_element) ox_element.is_a?(Array) && ox_element.length == 1 && ox_element.first.is_a?(String) end