Class: Tika::App

Inherits:
Object
  • Object
show all
Includes:
Commands
Defined in:
lib/tika/app.rb

Constant Summary collapse

DEFAULT_TIKA_PATH =
File.expand_path("../../../bin/tika-app.jar", __FILE__)

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ App

Returns a new instance of App.



24
25
26
# File 'lib/tika/app.rb', line 24

def initialize(opts={})
  @path = opts[:path] || self.class.path || ENV["TIKA_APP"] || DEFAULT_TIKA_PATH
end

Class Attribute Details

.pathObject

Returns the value of attribute path.



12
13
14
# File 'lib/tika/app.rb', line 12

def path
  @path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



21
22
23
# File 'lib/tika/app.rb', line 21

def path
  @path
end

#resultObject

Returns the value of attribute result.



22
23
24
# File 'lib/tika/app.rb', line 22

def result
  @result
end

Class Method Details

.install_tasksObject



14
15
16
# File 'lib/tika/app.rb', line 14

def install_tasks
  RakeTasks.install
end

Instance Method Details

#command_lineObject



73
74
75
# File 'lib/tika/app.rb', line 73

def command_line
  ["java", "-jar", path].freeze
end

#detect(file, opts = {}) ⇒ Object



60
61
62
# File 'lib/tika/app.rb', line 60

def detect(file, opts={})
  execute DetectCommand, file, opts
end

#get_detectorsObject Also known as: list_detectors



55
56
57
# File 'lib/tika/app.rb', line 55

def get_detectors
  execute GetDetectorsCommand
end

#get_language(file, opts = {}) ⇒ Object



64
65
66
# File 'lib/tika/app.rb', line 64

def get_language(file, opts={})
  execute GetLanguageCommand, file, opts
end

#get_metadata(file, opts = {}) ⇒ Object



32
33
34
# File 'lib/tika/app.rb', line 32

def (file, opts={})
  execute GetMetadataCommand, file, opts
end

#get_metadata_modelsObject Also known as: list_met_models



68
69
70
# File 'lib/tika/app.rb', line 68

def 
  execute GetMetadataModelsCommand
end

#get_mime_typesObject Also known as: list_supported_types



40
41
42
# File 'lib/tika/app.rb', line 40

def get_mime_types
  execute GetMimeTypesCommand
end

#get_parsersObject Also known as: list_parsers



45
46
47
# File 'lib/tika/app.rb', line 45

def get_parsers
  execute GetParsersCommand
end

#get_parsers_detailsObject Also known as: list_parser_details



50
51
52
# File 'lib/tika/app.rb', line 50

def get_parsers_details
  execute GetParsersDetailsCommand
end

#get_text(file, opts = {}) ⇒ Object



28
29
30
# File 'lib/tika/app.rb', line 28

def get_text(file, opts={})
  execute GetTextCommand, file, opts
end

#get_versionObject



36
37
38
# File 'lib/tika/app.rb', line 36

def get_version
  execute GetVersionCommand
end