Class: NewspaperWorks::Ingest::NDNP::ContainerIngest

Inherits:
Object
  • Object
show all
Includes:
Enumerable, NDNPMetsHelper
Defined in:
lib/newspaper_works/ingest/ndnp/container_ingest.rb

Constant Summary

Constants included from NDNPMetsHelper

NDNPMetsHelper::XML_NS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NDNPMetsHelper

#container, #container_path, #dmd_node, #normalize_path, #page_files, #xpath

Constructor Details

#initialize(path) ⇒ ContainerIngest

Returns a new instance of ContainerIngest.



11
12
13
14
15
16
17
18
19
20
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 11

def initialize(path)
  @path = path
  @doc = nil
  @metadata = nil
  # identifiers of control images, which we make accessible, but are
  #   not the primary focus of enumeration:
  @dmdids = nil
  @issue_paths = []
  load_doc
end

Instance Attribute Details

#dmdidsObject

Returns the value of attribute dmdids.



9
10
11
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 9

def dmdids
  @dmdids
end

#docObject

Returns the value of attribute doc.



9
10
11
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 9

def doc
  @doc
end

#issue_pathsObject

Returns the value of attribute issue_paths.



9
10
11
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 9

def issue_paths
  @issue_paths
end

#pathObject

Returns the value of attribute path.



9
10
11
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 9

def path
  @path
end

Instance Method Details

#eachObject



49
50
51
52
53
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 49

def each
  @issue_paths.each do |path|
    yield issue_by_path(path)
  end
end

#identifierObject



30
31
32
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 30

def identifier
  .reel_number
end

#inspectObject



22
23
24
25
26
27
28
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 22

def inspect
  format(
    "<#{self.class}:0x000000000%<oid>x\n" \
      "\tpath: '#{path}',\n",
    oid: object_id << 1
  )
end

#issue_by_path(path) ⇒ Object

Get IssueIngest object, given path to its XML return [NewspaperWorks::Ingest::NDNP::IssueIngest]



45
46
47
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 45

def issue_by_path(path)
  NewspaperWorks::Ingest::NDNP::IssueIngest.new(path)
end

#metadataObject



59
60
61
62
63
64
65
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 59

def 
  return @metadata unless @metadata.nil?
  @metadata = NewspaperWorks::Ingest::NDNP::ContainerMetadata.new(
    path,
    self
  )
end

#page_by_dmdid(dmdid) ⇒ NewspaperWorks::Ingest::NDNP::PageIngest

Return control image as PageIngest object.

These objects will not have pagination/sequence data, but
will provide an equivalent programmatic interface for file access
of control images, as one would access normal page files.


39
40
41
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 39

def page_by_dmdid(dmdid)
  NewspaperWorks::Ingest::NDNP::PageIngest.new(@path, dmdid, self)
end

#sizeObject



55
56
57
# File 'lib/newspaper_works/ingest/ndnp/container_ingest.rb', line 55

def size
  @issue_paths.size
end