Class: Libis::Tools::MetsFile::Div

Inherits:
Object
  • Object
show all
Includes:
MetsObject
Defined in:
lib/libis/tools/mets_objects.rb

Overview

Container class for creating a division in the METS.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MetsObject

#id, #initialize, #set_from_hash, #set_id, #to_s

Instance Attribute Details

#labelObject

Returns the value of attribute label.



473
474
475
# File 'lib/libis/tools/mets_objects.rb', line 473

def label
  @label
end

Instance Method Details

#<<(obj) ⇒ Object

Add an item (File or Libis::Tools::MetsFile::Div) to the current division



500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/libis/tools/mets_objects.rb', line 500

def <<(obj)
  self.mutex.synchronize do
    case obj
      when File
        files << obj
      when Div
        divs << obj
      else
        raise RuntimeError, "Child object type not supported: #{obj.class}"
    end
  end
end

#childrenObject

All items stored in the current division



481
482
483
# File 'lib/libis/tools/mets_objects.rb', line 481

def children
  files + divs
end

#divsObject

All division items stored in the current division



493
494
495
496
497
# File 'lib/libis/tools/mets_objects.rb', line 493

def divs
  self.mutex.synchronize do
    @divs ||= Array.new
  end
end

#filesObject

All file items stored in the current division



486
487
488
489
490
# File 'lib/libis/tools/mets_objects.rb', line 486

def files
  self.mutex.synchronize do
    @files ||= Array.new
  end
end

#xml_idObject

The id that will be used in the XML file to reference this division.



476
477
478
# File 'lib/libis/tools/mets_objects.rb', line 476

def xml_id
  "div-#{@id}"
end