Class: Libis::Tools::MetsFile::Div
- Includes:
- MetsObject, ThreadSafe
- Defined in:
- lib/libis/tools/mets_objects.rb
Overview
Container class for creating a division in the METS.
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
Instance Method Summary collapse
- #<<(obj) ⇒ Object
-
#children ⇒ Object
All items stored in the current division.
-
#divs ⇒ Object
All division items stored in the current division.
-
#files ⇒ Object
All file items stored in the current division.
-
#xml_id ⇒ Object
The id that will be used in the XML file to reference this division.
Methods included from ThreadSafe
Methods included from MetsObject
#id, #initialize, #set_from_hash, #set_id, #to_s
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
476 477 478 |
# File 'lib/libis/tools/mets_objects.rb', line 476 def label @label end |
Instance Method Details
#<<(obj) ⇒ Object
Add an item (File or Libis::Tools::MetsFile::Div) to the current division
503 504 505 506 507 508 509 510 511 512 513 514 |
# File 'lib/libis/tools/mets_objects.rb', line 503 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 |
#children ⇒ Object
All items stored in the current division
484 485 486 |
# File 'lib/libis/tools/mets_objects.rb', line 484 def children files + divs end |
#divs ⇒ Object
All division items stored in the current division
496 497 498 499 500 |
# File 'lib/libis/tools/mets_objects.rb', line 496 def divs self.mutex.synchronize do @divs ||= Array.new end end |
#files ⇒ Object
All file items stored in the current division
489 490 491 492 493 |
# File 'lib/libis/tools/mets_objects.rb', line 489 def files self.mutex.synchronize do @files ||= Array.new end end |
#xml_id ⇒ Object
The id that will be used in the XML file to reference this division.
479 480 481 |
# File 'lib/libis/tools/mets_objects.rb', line 479 def xml_id "div-#{@id}" end |