Sha256: 8e05e38ca6af5b0d4abcb4a0ad61b05544b1936d7822e092345e70c5c317a3ad
Contents?: true
Size: 722 Bytes
Versions: 1
Compression:
Stored size: 722 Bytes
Contents
module MusicBrainz module Bindings module Relations def parse(xml) hash = { urls: {} } xml.xpath('./relation-list[@target-type="url"]/relation').map do |xml| next unless type = xml.attribute('type') type = type.value.downcase.split(" ").join("_").to_sym target = xml.xpath('./target').text if hash[:urls][type].nil? then hash[:urls][type] = target elsif hash[:urls][type].is_a?(Array) then hash[:urls][type] << target else hash[:urls][type] = [hash[:urls][type]]; hash[:urls][type] << target end end hash end extend self end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
musicbrainz-0.8.0 | lib/musicbrainz/bindings/relations.rb |