Sha256: 2c6a4b32dbc976b8e7809d20ce6fff44b7324ade81cb6af178fd3be7bf3fd7f9
Contents?: true
Size: 935 Bytes
Versions: 20
Compression:
Stored size: 935 Bytes
Contents
module Ddr::Models::Structures # # Wraps a Nokogiri (XML) 'file' node # class File < SimpleDelegator def id self['ID'] end def use self['USE'] end def files xpath('xmlns:file').map { |node| File.new(node) } end def flocats xpath('xmlns:FLocat').map { |node| FLocat.new(node) } end 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 def repo_ids flocats.map(&:repo_id) end 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 def self.find(structure, fileid) structure.files[fileid] end end end
Version data entries
20 entries across 20 versions & 1 rubygems