Class: MessageBus::Client::MessageHandler::SubscribedChannel

Inherits:
Struct
  • Object
show all
Defined in:
lib/message_bus/client/message_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(last_id = -1)) ⇒ SubscribedChannel

Returns a new instance of SubscribedChannel.



3
4
5
6
# File 'lib/message_bus/client/message_handler.rb', line 3

def initialize(last_id = -1)
  self.callbacks = []
  self.last_id = last_id
end

Instance Attribute Details

#callbacksObject

Returns the value of attribute callbacks

Returns:

  • (Object)

    the current value of callbacks



2
3
4
# File 'lib/message_bus/client/message_handler.rb', line 2

def callbacks
  @callbacks
end

#last_idObject

Returns the value of attribute last_id

Returns:

  • (Object)

    the current value of last_id



2
3
4
# File 'lib/message_bus/client/message_handler.rb', line 2

def last_id
  @last_id
end

Instance Method Details

#callback(payload) ⇒ Object



8
9
10
11
12
# File 'lib/message_bus/client/message_handler.rb', line 8

def callback(payload)
  callbacks.each do |callback|
    callback.call(payload)
  end
end