Class: Ddr::Extraction::Adapters::TikaAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/ddr/extraction/adapters/tika_adapter.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.checksum_typeObject

Tika distribution checksum type



34
35
36
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 34

def checksum_type
  @checksum_type
end

.checksum_valueObject

Tika distribution checksum



31
32
33
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 31

def checksum_value
  @checksum_value
end

.commandObject

Base command



22
23
24
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 22

def command
  @command
end

.download_urlObject

URL to download distribution



25
26
27
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 25

def download_url
  @download_url
end

.pathObject

Path to tika-app.jar



19
20
21
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 19

def path
  @path
end

.portObject

Tika server port (optional, required for server)



37
38
39
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 37

def port
  @port
end

.verify_checksumObject

Verify checksum?



28
29
30
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 28

def verify_checksum
  @verify_checksum
end

.versionObject

Tika version



16
17
18
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 16

def version
  @version
end

Instance Method Details

#extract_text(file) ⇒ IO

Extract text from file

Parameters:

  • file (String)

    path to file from which to extract text

Returns:

  • (IO)

    the output



10
11
12
# File 'lib/ddr/extraction/adapters/tika_adapter.rb', line 10

def extract_text(file)
  IO.popen(["java", "-jar", self.class.path, "--text", file])
end