class Ddr::Structures::File

Wraps a Nokogiri (XML) 'file' node

Public Class Methods

build(args) click to toggle source
# File lib/ddr/structures/file.rb, line 40
def self.build(args)
  node = Nokogiri::XML::Node.new('file', args[:document])
  node['ID'] = args[:id] if args[:id]
  node['USE'] = args[:use] if args[:use]
  node
end
find(structure, fileid) click to toggle source
# File lib/ddr/structures/file.rb, line 47
def self.find(structure, fileid)
  structure.files[fileid]
end

Public Instance Methods

effective_use() click to toggle source
# File lib/ddr/structures/file.rb, line 23
def effective_use
  if use
    use
  else
    case parent.name
      when "file"
        File.new(parent).effective_use
      when "fileGrp"
        FileGrp.new(parent).effective_use
    end
  end
end
files() click to toggle source
# File lib/ddr/structures/file.rb, line 15
def files
  xpath('xmlns:file').map { |node| File.new(node) }
end
flocats() click to toggle source
# File lib/ddr/structures/file.rb, line 19
def flocats
  xpath('xmlns:FLocat').map { |node| FLocat.new(node) }
end
id() click to toggle source
# File lib/ddr/structures/file.rb, line 7
def id
  self['ID']
end
repo_ids() click to toggle source
# File lib/ddr/structures/file.rb, line 36
def repo_ids
  flocats.map(&:repo_id)
end
use() click to toggle source
# File lib/ddr/structures/file.rb, line 11
def use
  self['USE']
end