Class: Ddr::Structures::FLocat

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/ddr/structures/f_locat.rb

Overview

Wraps a Nokogiri (XML) ‘FLocat’ node

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(args) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/ddr/structures/f_locat.rb', line 43

def self.build(args)
  node = Nokogiri::XML::Node.new('FLocat', args[:document])
  node['ID'] = args[:id] if args[:id]
  node['LOCTYPE'] = args[:loctype] if args[:loctype]
  node['OTHERLOCTYPE'] = args[:otherloctype] if args[:otherloctype]
  node['USE'] = args[:use] if args[:use]
  node['xlink:href'] = args[:href] if args[:href]
  node
end

Instance Method Details

#arkObject



31
32
33
# File 'lib/ddr/structures/f_locat.rb', line 31

def ark
  href if ark?
end

#ark?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/ddr/structures/f_locat.rb', line 27

def ark?
  loctype == 'ARK'
end

#effective_useObject



35
36
37
# File 'lib/ddr/structures/f_locat.rb', line 35

def effective_use
  use ? use : File.new(parent).effective_use
end

#hrefObject



23
24
25
# File 'lib/ddr/structures/f_locat.rb', line 23

def href
  self['xlink:href']
end

#idObject



7
8
9
# File 'lib/ddr/structures/f_locat.rb', line 7

def id
  self['ID']
end

#loctypeObject



11
12
13
# File 'lib/ddr/structures/f_locat.rb', line 11

def loctype
  self['LOCTYPE']
end

#otherloctypeObject



15
16
17
# File 'lib/ddr/structures/f_locat.rb', line 15

def otherloctype
  self['OTHERLOCTYPE']
end

#repo_idObject



39
40
41
# File 'lib/ddr/structures/f_locat.rb', line 39

def repo_id
  SolrDocument.find_by_permanent_id(ark).id if ark?
end

#useObject



19
20
21
# File 'lib/ddr/structures/f_locat.rb', line 19

def use
  self['USE']
end