Class: Opener::Coreference
- Inherits:
-
Object
- Object
- Opener::Coreference
- Defined in:
- lib/opener/coreference.rb,
lib/opener/coreference/cli.rb,
lib/opener/coreference/server.rb,
lib/opener/coreference/version.rb,
lib/opener/coreference/error_layer.rb
Defined Under Namespace
Classes: CLI, ErrorLayer, Server
Constant Summary collapse
- DEFAULT_OPTIONS =
Hash containing the default options to use.
{ :args => [], }.freeze
- VERSION =
"1.1.0"
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Coreference
constructor
A new instance of Coreference.
-
#run(input) ⇒ Array
Processes the input and returns an array containing the output of STDOUT, STDERR and an object containing process information.
Constructor Details
#initialize(options = {}) ⇒ Coreference
Returns a new instance of Coreference.
29 30 31 |
# File 'lib/opener/coreference.rb', line 29 def initialize( = {}) @options = DEFAULT_OPTIONS.merge() end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/opener/coreference.rb', line 11 def @options end |
Instance Method Details
#run(input) ⇒ Array
Processes the input and returns an array containing the output of STDOUT, STDERR and an object containing process information.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/opener/coreference.rb', line 40 def run(input) begin language = language_from_kaf(input) args = [:args].dup if language_constant_defined?(language) kernel = language.new(:args => args) else kernel = Coreferences::Base.new(:args => args, :language => language) end stdout, stderr, process = kernel.run(input) raise stderr unless process.success? return stdout rescue Exception => error return ErrorLayer.new(input, error., self.class).add end end |