Class: FreeLing::Analyzer::ProcessWrapper
- Inherits:
-
Object
- Object
- FreeLing::Analyzer::ProcessWrapper
- Defined in:
- lib/freeling/analyzer/process_wrapper.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#env ⇒ Object
Returns the value of attribute env.
-
#error_log ⇒ Object
Returns the value of attribute error_log.
-
#output_fd ⇒ Object
Returns the value of attribute output_fd.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(command, output_fd, env = {}) ⇒ ProcessWrapper
constructor
A new instance of ProcessWrapper.
- #run ⇒ Object
Constructor Details
#initialize(command, output_fd, env = {}) ⇒ ProcessWrapper
Returns a new instance of ProcessWrapper.
10 11 12 13 14 15 |
# File 'lib/freeling/analyzer/process_wrapper.rb', line 10 def initialize(command, output_fd, env={}) @command = command @output_fd = output_fd @env = env @error_log = nil end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
8 9 10 |
# File 'lib/freeling/analyzer/process_wrapper.rb', line 8 def command @command end |
#env ⇒ Object
Returns the value of attribute env.
8 9 10 |
# File 'lib/freeling/analyzer/process_wrapper.rb', line 8 def env @env end |
#error_log ⇒ Object
Returns the value of attribute error_log.
8 9 10 |
# File 'lib/freeling/analyzer/process_wrapper.rb', line 8 def error_log @error_log end |
#output_fd ⇒ Object
Returns the value of attribute output_fd.
8 9 10 |
# File 'lib/freeling/analyzer/process_wrapper.rb', line 8 def output_fd @output_fd end |
Instance Method Details
#close ⇒ Object
39 40 41 |
# File 'lib/freeling/analyzer/process_wrapper.rb', line 39 def close close_process end |
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/freeling/analyzer/process_wrapper.rb', line 17 def run @error_log = nil Enumerator.new do |yielder| open_process if @stdout.nil? run_process end while line = @stdout.gets line.chomp! yielder << line end @stdout.close_read @error_log = @stderr.read @write_thr.join close_process end end |