Sha256: f2c169cec552330fca6f19ea062d5cd8571464c266f416ff6699201ee27c834b

Contents?: true

Size: 655 Bytes

Versions: 33

Compression:

Stored size: 655 Bytes

Contents

module Ddr::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::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

33 entries across 33 versions & 1 rubygems

Version Path
ddr-core-1.11.0 lib/ddr/structures/fptr.rb
ddr-core-1.10.0 lib/ddr/structures/fptr.rb
ddr-core-1.9.0 lib/ddr/structures/fptr.rb
ddr-core-1.8.0 lib/ddr/structures/fptr.rb
ddr-core-1.7.0 lib/ddr/structures/fptr.rb
ddr-core-1.6.6 lib/ddr/structures/fptr.rb
ddr-core-1.6.5 lib/ddr/structures/fptr.rb
ddr-core-1.6.4 lib/ddr/structures/fptr.rb
ddr-core-1.6.3 lib/ddr/structures/fptr.rb
ddr-core-1.6.2 lib/ddr/structures/fptr.rb
ddr-core-1.6.1 lib/ddr/structures/fptr.rb
ddr-core-1.6.0 lib/ddr/structures/fptr.rb
ddr-core-1.5.5 lib/ddr/structures/fptr.rb
ddr-core-1.5.4 lib/ddr/structures/fptr.rb
ddr-core-1.5.2 lib/ddr/structures/fptr.rb
ddr-core-1.5.3 lib/ddr/structures/fptr.rb
ddr-core-1.5.1 lib/ddr/structures/fptr.rb
ddr-core-1.4.4 lib/ddr/structures/fptr.rb
ddr-core-1.4.3 lib/ddr/structures/fptr.rb
ddr-core-1.4.2 lib/ddr/structures/fptr.rb