Class: Goru::Routines::Channel

Inherits:
Goru::Routine show all
Defined in:
lib/goru/routines/channel.rb

Overview

public

Constant Summary

Constants inherited from Goru::Routine

Goru::Routine::STATUS_ERRORED, Goru::Routine::STATUS_FINISHED, Goru::Routine::STATUS_IDLE, Goru::Routine::STATUS_PAUSED, Goru::Routine::STATUS_READY

Instance Attribute Summary

Attributes inherited from Goru::Routine

#debug, #error, #reactor, #state, #status

Instance Method Summary collapse

Methods inherited from Goru::Routine

#add_observer, #adopted, #call, #finished, #finished?, #pause, #ready?, #remove_observer, #result, #resume, #sleep, #update

Constructor Details

#initialize(state = nil, channel:, &block) ⇒ Channel

Returns a new instance of Channel.



10
11
12
13
14
15
16
# File 'lib/goru/routines/channel.rb', line 10

def initialize(state = nil, channel:, &block)
  super(state, &block)

  @channel = channel
  @channel.add_observer(self)
  update_status
end

Instance Method Details

#channel_closedObject



37
38
39
# File 'lib/goru/routines/channel.rb', line 37

def channel_closed
  update_status
end

#channel_readObject



33
34
35
# File 'lib/goru/routines/channel.rb', line 33

def channel_read
  update_status
end

#channel_receivedObject



29
30
31
# File 'lib/goru/routines/channel.rb', line 29

def channel_received
  update_status
end