Class: NewspaperWorks::Ingest::NDNP::IssueIngest
- Inherits:
-
Object
- Object
- NewspaperWorks::Ingest::NDNP::IssueIngest
show all
- Includes:
- Enumerable, NDNPMetsHelper
- Defined in:
- lib/newspaper_works/ingest/ndnp/issue_ingest.rb
Constant Summary
NDNPMetsHelper::XML_NS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#container, #container_path, #dmd_node, #normalize_path, #page_files, #xpath
Constructor Details
Returns a new instance of IssueIngest.
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 10
def initialize(path)
@path = path
@doc = nil
@metadata = nil
@dmdids = nil
load_doc
@page_cache = {}
end
|
Instance Attribute Details
#dmdids ⇒ Object
Returns the value of attribute dmdids.
8
9
10
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 8
def dmdids
@dmdids
end
|
#doc ⇒ Object
Returns the value of attribute doc.
8
9
10
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 8
def doc
@doc
end
|
#path ⇒ Object
Returns the value of attribute path.
8
9
10
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 8
def path
@path
end
|
Instance Method Details
#each ⇒ Object
50
51
52
53
54
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 50
def each
@dmdids.each do |dmdid|
yield page_by_dmdid(dmdid)
end
end
|
#identifier ⇒ Object
29
30
31
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 29
def identifier
metadata.lccn
end
|
#inspect ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 21
def inspect
format(
"<#{self.class}:0x000000000%<oid>x\n" \
"\tpath: '#{path}',\n",
oid: object_id << 1
)
end
|
60
61
62
63
64
65
66
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 60
def metadata
return @metadata unless @metadata.nil?
@metadata = NewspaperWorks::Ingest::NDNP::IssueMetadata.new(
path,
self
)
end
|
#page_by_dmdid(dmdid) ⇒ Object
33
34
35
36
37
38
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 33
def page_by_dmdid(dmdid)
return @page_cache[dmdid] if @page_cache.key?(dmdid)
p = NewspaperWorks::Ingest::NDNP::PageIngest.new(@path, dmdid, self)
@page_cache[dmdid] = p
p
end
|
#page_by_sequence_number(n) ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 40
def page_by_sequence_number(n)
page_by_dmdid(
doc.xpath(
"//mods:extent//mods:start[text()='#{n}']",
mets: 'http://www.loc.gov/METS/',
mods: 'http://www.loc.gov/mods/v3'
).first.ancestors('dmdSec').first['ID']
)
end
|
#size ⇒ Object
56
57
58
|
# File 'lib/newspaper_works/ingest/ndnp/issue_ingest.rb', line 56
def size
@dmdids.size
end
|