class NewspaperWorks::Ingest::IssueImages
Represents TIFF/JP2 issue, provides metadata, enumerates PageImage
objects
Constants
- IMAGE_EXT
things that look like images, by file extension:
Attributes
path[RW]
publication[RW]
Public Class Methods
new(path, publication)
click to toggle source
# File lib/newspaper_works/ingest/issue_images.rb, line 21 def initialize(path, publication) @path = path raise ArgumentError, 'Path not directory' unless File.directory?(path) validate_path # as a NewspaperWorks::Ingest::PublicationInfo object: @publication = publication @pages = nil end
Public Instance Methods
info(path)
click to toggle source
# File lib/newspaper_works/ingest/issue_images.rb, line 43 def info(path) page_seq_num = page_paths.index(path) + 1 NewspaperWorks::Ingest::PageImage.new(path, self, page_seq_num) end
page_paths()
click to toggle source
# File lib/newspaper_works/ingest/issue_images.rb, line 30 def page_paths return @pages unless @pages.nil? @pages = [] entries = Dir.entries(path).map { |n| File.join(path, n) } entries.sort.each do |p| next unless File.ftype(p) == 'file' ext = File.basename(p).downcase.split('.')[-1] next unless IMAGE_EXT.include?(ext) @pages.push(p) end @pages end
Also aliased as: paths