class Tika::App

Constants

DEFAULT_TIKA_PATH

Attributes

path[RW]
path[R]
result[RW]

Public Class Methods

install_tasks() click to toggle source
# File lib/tika/app.rb, line 14
def install_tasks
  RakeTasks.install
end
new(opts={}) click to toggle source
# File lib/tika/app.rb, line 24
def initialize(opts={})
  @path = opts[:path] || self.class.path || ENV["TIKA_APP"] || DEFAULT_TIKA_PATH
end

Public Instance Methods

command_line() click to toggle source
# File lib/tika/app.rb, line 73
def command_line
  ["java", "-jar", path].freeze
end
detect(file, opts={}) click to toggle source
# File lib/tika/app.rb, line 60
def detect(file, opts={})
  execute DetectCommand, file, opts
end
get_detectors() click to toggle source
# File lib/tika/app.rb, line 55
def get_detectors
  execute GetDetectorsCommand
end
Also aliased as: list_detectors
get_language(file, opts={}) click to toggle source
# File lib/tika/app.rb, line 64
def get_language(file, opts={})
  execute GetLanguageCommand, file, opts
end
get_metadata(file, opts={}) click to toggle source
# File lib/tika/app.rb, line 32
def get_metadata(file, opts={})
  execute GetMetadataCommand, file, opts
end
get_metadata_models() click to toggle source
# File lib/tika/app.rb, line 68
def get_metadata_models
  execute GetMetadataModelsCommand
end
Also aliased as: list_met_models
get_mime_types() click to toggle source
# File lib/tika/app.rb, line 40
def get_mime_types
  execute GetMimeTypesCommand
end
Also aliased as: list_supported_types
get_parsers() click to toggle source
# File lib/tika/app.rb, line 45
def get_parsers
  execute GetParsersCommand
end
Also aliased as: list_parsers
get_parsers_details() click to toggle source
# File lib/tika/app.rb, line 50
def get_parsers_details
  execute GetParsersDetailsCommand
end
Also aliased as: list_parser_details
get_text(file, opts={}) click to toggle source
# File lib/tika/app.rb, line 28
def get_text(file, opts={})
  execute GetTextCommand, file, opts
end
get_version() click to toggle source
# File lib/tika/app.rb, line 36
def get_version
  execute GetVersionCommand
end
list_detectors()
Alias for: get_detectors
list_met_models()
Alias for: get_metadata_models
list_parser_details()
Alias for: get_parsers_details
list_parsers()
Alias for: get_parsers
list_supported_types()
Alias for: get_mime_types

Private Instance Methods

execute(command, *args) click to toggle source
# File lib/tika/app.rb, line 83
def execute(command, *args)
  reset
  @result = command.execute(self, *args)
  if result.success?
    result.render
  else
    raise Error, result.error
  end
end
reset() click to toggle source
# File lib/tika/app.rb, line 79
def reset
  @result = nil
end