lib/reality/describers/wikidata/response.rb
# Response fail was returned by target MediaWiki API.
Response fail was returned by target MediaWiki API.
Response fail was returned by target MediaWiki API .
def merge_responses(new_response)
      merger = lambda do |_k, v1, v2|
        if v1.is_a?(Hash) && v2.is_a?(Hash)
          v1.merge(v2, &merger)
        elsif v1.is_a?(Array) && v2.is_a?(Array)
          v1 + v2
        else
          v2
        end
      end
       Deep recursive merge is necessary because MediaWiki could split response in parts unpredicatably
       (like ['query']['pages'][some_page_id] can be present on several pages, providing different
       parts of a page).
      @data.merge(new_response, &merger)
    end
def merge_responses ( new_response ) merger = lambda do | _k , v1 , v2 | if v1 . is_a? ( Hash ) && v2 . is_a? ( Hash ) v1 . merge ( v2 , & merger ) elsif v1 . is_a? ( Array ) && v2 . is_a? ( Array ) v1 + v2 else v2 end end @data . merge ( new_response , & merger ) end
Response fail was returned by target MediaWiki API.
Response fail was returned by target MediaWiki API .
# Newest page is responsible for all metadata, so we take entire new response and only data # part of old one. # # Deep recursive merge is necessary because MediaWiki could split response in parts unpredicatably # (like ['query']['pages'][some_page_id] can be present on several pages, providing different # parts of a page).
new_response
<not_specific>