Sha256: 8471cfb935cd9d8b01c11ca52075641dc9d6bac9fd5d0b62543b97ec41be480a

Contents?: true

Size: 671 Bytes

Versions: 20

Compression:

Stored size: 671 Bytes

Contents

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

    def id
      self['ID']
    end

    def fileid
      self['FILEID']
    end

    def dereferenced_hash
      structure = Ddr::Models::Structure.new(document)
      file = File.find(structure, fileid)
      repo_id = file.repo_ids.first
      use = file.flocats.first.effective_use
      { id: id, repo_id: repo_id, use: use }.compact
    end

    def self.build(args)
      node = Nokogiri::XML::Node.new('fptr', args[:document])
      node['ID'] = args[:id] if args[:id]
      node['FILEID'] = args[:fileid] if args[:fileid]
      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/fptr.rb
ddr-models-2.10.2 lib/ddr/models/structures/fptr.rb
ddr-models-2.10.1 lib/ddr/models/structures/fptr.rb
ddr-models-2.10.0 lib/ddr/models/structures/fptr.rb
ddr-models-2.10.0.rc2 lib/ddr/models/structures/fptr.rb
ddr-models-2.10.0.rc1 lib/ddr/models/structures/fptr.rb
ddr-models-2.9.2 lib/ddr/models/structures/fptr.rb
ddr-models-2.9.1 lib/ddr/models/structures/fptr.rb
ddr-models-2.9.0 lib/ddr/models/structures/fptr.rb
ddr-models-2.9.0.rc1 lib/ddr/models/structures/fptr.rb
ddr-models-2.8.0 lib/ddr/models/structures/fptr.rb
ddr-models-2.8.0.rc1 lib/ddr/models/structures/fptr.rb
ddr-models-2.7.6 lib/ddr/models/structures/fptr.rb
ddr-models-2.7.5 lib/ddr/models/structures/fptr.rb
ddr-models-2.7.4 lib/ddr/models/structures/fptr.rb
ddr-models-2.7.3 lib/ddr/models/structures/fptr.rb
ddr-models-2.7.2 lib/ddr/models/structures/fptr.rb
ddr-models-2.7.1 lib/ddr/models/structures/fptr.rb
ddr-models-2.7.0 lib/ddr/models/structures/fptr.rb
ddr-models-2.7.0.rc1 lib/ddr/models/structures/fptr.rb