Sha256: 4e7ef0b1f0b53569d26571ba265f69d4e542d899df97de028126d83f4e0c1825
Contents?: true
Size: 884 Bytes
Versions: 20
Compression:
Stored size: 884 Bytes
Contents
module Ddr::Models::Structures # # Wraps a Nokogiri (XML) 'mptr' node # class Mptr < SimpleDelegator def id self['ID'] end def loctype self['LOCTYPE'] end def otherloctype self['OTHERLOCTYPE'] end def href self['xlink:href'] end def ark? loctype == 'ARK' end def ark href if ark? end def repo_id SolrDocument.find_by_permanent_id(ark).id if ark? end def dereferenced_hash { id: id, repo_id: repo_id }.compact end def self.build(args) node = Nokogiri::XML::Node.new('mptr', args[:document]) node['ID'] = args[:id] if args[:id] node['LOCTYPE'] = args[:loctype] if args[:loctype] node['OTHERLOCTYPE'] = args[:otherloctype] if args[:otherloctype] node['xlink:href'] = args[:href] if args[:href] node end end end
Version data entries
20 entries across 20 versions & 1 rubygems