class Ddr::Structures::Mptr

Wraps a Nokogiri (XML) 'mptr' node

Public Class Methods

build(args) click to toggle source
# File lib/ddr/structures/mptr.rb, line 39
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

Public Instance Methods

ark() click to toggle source
# File lib/ddr/structures/mptr.rb, line 27
def ark
  href if ark?
end
ark?() click to toggle source
# File lib/ddr/structures/mptr.rb, line 23
def ark?
  loctype == 'ARK'
end
dereferenced_hash() click to toggle source
# File lib/ddr/structures/mptr.rb, line 35
def dereferenced_hash
  { id: id, repo_id: repo_id }.compact
end
href() click to toggle source
# File lib/ddr/structures/mptr.rb, line 19
def href
  self['xlink:href']
end
id() click to toggle source
# File lib/ddr/structures/mptr.rb, line 7
def id
  self['ID']
end
loctype() click to toggle source
# File lib/ddr/structures/mptr.rb, line 11
def loctype
  self['LOCTYPE']
end
otherloctype() click to toggle source
# File lib/ddr/structures/mptr.rb, line 15
def otherloctype
  self['OTHERLOCTYPE']
end
repo_id() click to toggle source
# File lib/ddr/structures/mptr.rb, line 31
def repo_id
  SolrDocument.find_by_permanent_id(ark).id if ark?
end