Class: Goru::Routines::Channel

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

Overview

public

Instance Attribute Summary

Attributes inherited from Goru::Routine

#state, #status

Instance Method Summary collapse

Methods inherited from Goru::Routine

#call, #finished, #reactor=, #result, #sleep, #update, #wake

Constructor Details

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

Returns a new instance of Channel.



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

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

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

Instance Method Details

#channel_closedObject



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

def channel_closed
  update_status
end

#channel_readObject



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

def channel_read
  update_status
end

#channel_receivedObject



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

def channel_received
  update_status
end

#channel_reopenedObject



40
41
42
# File 'lib/goru/routines/channel.rb', line 40

def channel_reopened
  update_status
end