Class: Tika::Command
- Inherits:
-
Object
- Object
- Tika::Command
- Defined in:
- lib/tika/command.rb
Direct Known Subclasses
Tika::Commands::DetectCommand, Tika::Commands::GetDetectorsCommand, Tika::Commands::GetLanguageCommand, Tika::Commands::GetMetadataCommand, Tika::Commands::GetMetadataModelsCommand, Tika::Commands::GetMimeTypesCommand, Tika::Commands::GetParsersCommand, Tika::Commands::GetParsersDetailsCommand, Tika::Commands::GetTextCommand, Tika::Commands::GetVersionCommand
Class Attribute Summary collapse
-
.options ⇒ Object
Returns the value of attribute options.
-
.result_class ⇒ Object
Returns the value of attribute result_class.
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #command_line ⇒ Object
- #execute ⇒ Object
-
#initialize(app, *args) ⇒ Command
constructor
A new instance of Command.
- #result_class ⇒ Object
Constructor Details
#initialize(app, *args) ⇒ Command
Returns a new instance of Command.
16 17 18 19 20 |
# File 'lib/tika/command.rb', line 16 def initialize(app, *args) @app = app @file = args.shift @options = args.pop || {} end |
Class Attribute Details
.options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/tika/command.rb', line 7 def @options end |
.result_class ⇒ Object
Returns the value of attribute result_class.
7 8 9 |
# File 'lib/tika/command.rb', line 7 def result_class @result_class end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
14 15 16 |
# File 'lib/tika/command.rb', line 14 def app @app end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
14 15 16 |
# File 'lib/tika/command.rb', line 14 def file @file end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/tika/command.rb', line 14 def @options end |
Class Method Details
.execute(app, *args) ⇒ Object
9 10 11 |
# File 'lib/tika/command.rb', line 9 def execute(app, *args) new(app, *args).execute end |
Instance Method Details
#command_line ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tika/command.rb', line 26 def command_line cmd = app.command_line + self.class. if [:password] cmd << "-p#{[:password]}" end if file cmd << file end cmd end |
#execute ⇒ Object
37 38 39 40 |
# File 'lib/tika/command.rb', line 37 def execute raw_result = Open3.capture3(*command_line) result_class.new(*raw_result) end |
#result_class ⇒ Object
22 23 24 |
# File 'lib/tika/command.rb', line 22 def result_class self.class.result_class end |