Class: Weechat::Process
Instance Attribute Summary collapse
-
#collect ⇒ Object
readonly
Returns a new instance of Process.
Attributes inherited from Hook
Attributes included from Pointer
Instance Method Summary collapse
- #buffer(stdout, stderr) ⇒ Object
-
#initialize(command, timeout = 0, collect = false, &callback) ⇒ Process
constructor
A new instance of Process.
- #stderr ⇒ Object
- #stdout ⇒ Object
Methods inherited from Hook
#call, compute_free_id, find_by_id, #hooked?, hooks, inherited, init, register, #unhook, unhook, unhook_all, unregister
Methods included from Pointer
Constructor Details
#initialize(command, timeout = 0, collect = false, &callback) ⇒ Process
Returns a new instance of Process.
10 11 12 13 14 15 16 17 |
# File 'lib/weechat/process.rb', line 10 def initialize(command, timeout = 0, collect = false, &callback) super @command = command @collect = collect @stdout, @stderr = [], [] @callback = EvaluatedCallback.new(callback) @ptr = Weechat.hook_process(command, timeout, "process_callback", id.to_s) end |
Instance Attribute Details
#collect ⇒ Object (readonly)
Returns a new instance of Process
9 10 11 |
# File 'lib/weechat/process.rb', line 9 def collect @collect end |
Instance Method Details
#buffer(stdout, stderr) ⇒ Object
27 28 29 30 |
# File 'lib/weechat/process.rb', line 27 def buffer(stdout, stderr) @stdout << stdout @stderr << stderr end |
#stderr ⇒ Object
23 24 25 |
# File 'lib/weechat/process.rb', line 23 def stderr @stderr.join("") end |
#stdout ⇒ Object
19 20 21 |
# File 'lib/weechat/process.rb', line 19 def stdout @stdout.join("") end |