Class: DocImageExtract::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/doc_image_extract/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Document

Returns a new instance of Document.



5
6
7
# File 'lib/doc_image_extract/document.rb', line 5

def initialize file
  @file = file
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



3
4
5
# File 'lib/doc_image_extract/document.rb', line 3

def file
  @file
end

Instance Method Details

#picturesObject



19
20
21
# File 'lib/doc_image_extract/document.rb', line 19

def pictures
  reader.pictures
end

#readerObject



9
10
11
12
13
14
15
16
17
# File 'lib/doc_image_extract/document.rb', line 9

def reader
  @reader ||= begin
    if file =~ /docx\Z/
      Reader::Xwpf.new file
    else
      Reader::Hwpf.new file
    end
  end
end