Sha256: 5fc542b08401380a271a822623ca8900932a74ecc3e21548494c145c24c31506

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

module MusicBrainz
  module Bindings
    module Artist
      def parse(xml)
        xml = xml.xpath('./artist') 

        return {} if xml.empty?
        
        {
          id: (xml.attribute('id').value rescue nil),
          type: (xml.attribute('type').value rescue nil),
          name: (xml.xpath('./name').text.gsub(/[`’]/, "'") rescue nil),
          country: (xml.xpath('./country').text rescue nil),
          date_begin: (xml.xpath('./life-span/begin').text rescue nil),
          date_end: (xml.xpath('./life-span/end').text rescue nil)
        }.merge(Relations.parse(xml))
      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/artist.rb