Sha256: 35839899f6a4f64ecc8e5c6051193c9fe8ea8bab6dfc69d96e926d1ed15a98d0

Contents?: true

Size: 976 Bytes

Versions: 20

Compression:

Stored size: 976 Bytes

Contents

module Ddr::Models::Structures
  #
  # Wraps a Nokogiri (XML) 'FLocat' node
  #
  class FLocat < SimpleDelegator

    def id
      self['ID']
    end

    def loctype
      self['LOCTYPE']
    end

    def otherloctype
      self['OTHERLOCTYPE']
    end

    def use
      self['USE']
    end

    def href
      self['xlink:href']
    end

    def ark?
      loctype == 'ARK'
    end

    def ark
      href if ark?
    end

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

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

    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

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ddr-models-2.11.0 lib/ddr/models/structures/f_locat.rb
ddr-models-2.10.2 lib/ddr/models/structures/f_locat.rb
ddr-models-2.10.1 lib/ddr/models/structures/f_locat.rb
ddr-models-2.10.0 lib/ddr/models/structures/f_locat.rb
ddr-models-2.10.0.rc2 lib/ddr/models/structures/f_locat.rb
ddr-models-2.10.0.rc1 lib/ddr/models/structures/f_locat.rb
ddr-models-2.9.2 lib/ddr/models/structures/f_locat.rb
ddr-models-2.9.1 lib/ddr/models/structures/f_locat.rb
ddr-models-2.9.0 lib/ddr/models/structures/f_locat.rb
ddr-models-2.9.0.rc1 lib/ddr/models/structures/f_locat.rb
ddr-models-2.8.0 lib/ddr/models/structures/f_locat.rb
ddr-models-2.8.0.rc1 lib/ddr/models/structures/f_locat.rb
ddr-models-2.7.6 lib/ddr/models/structures/f_locat.rb
ddr-models-2.7.5 lib/ddr/models/structures/f_locat.rb
ddr-models-2.7.4 lib/ddr/models/structures/f_locat.rb
ddr-models-2.7.3 lib/ddr/models/structures/f_locat.rb
ddr-models-2.7.2 lib/ddr/models/structures/f_locat.rb
ddr-models-2.7.1 lib/ddr/models/structures/f_locat.rb
ddr-models-2.7.0 lib/ddr/models/structures/f_locat.rb
ddr-models-2.7.0.rc1 lib/ddr/models/structures/f_locat.rb