Class: Pwrake::CommChannel
- Inherits:
-
Object
- Object
- Pwrake::CommChannel
- Defined in:
- lib/pwrake/branch/communicator.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #get_line ⇒ Object
- #halt ⇒ Object
-
#initialize(host, id, queue, writer, ios = []) ⇒ CommChannel
constructor
A new instance of CommChannel.
- #put_line(s) ⇒ Object
Constructor Details
#initialize(host, id, queue, writer, ios = []) ⇒ CommChannel
Returns a new instance of CommChannel.
5 6 7 8 9 10 11 |
# File 'lib/pwrake/branch/communicator.rb', line 5 def initialize(host,id,queue,writer,ios=[]) @host = host @id = id @queue = queue @writer = writer @ios = ios end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
13 14 15 |
# File 'lib/pwrake/branch/communicator.rb', line 13 def host @host end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13 14 15 |
# File 'lib/pwrake/branch/communicator.rb', line 13 def id @id end |
Instance Method Details
#get_line ⇒ Object
24 25 26 |
# File 'lib/pwrake/branch/communicator.rb', line 24 def get_line @queue.deq end |
#halt ⇒ Object
28 29 30 31 |
# File 'lib/pwrake/branch/communicator.rb', line 28 def halt @queue.halt @writer.halt end |
#put_line(s) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/pwrake/branch/communicator.rb', line 15 def put_line(s) if $cause_fault $cause_fault = nil Log.warn("closing writer io caller=\n#{caller.join("\n")}") @ios.each{|io| io.close} end @writer.put_line(s,@id) end |