Method: Lowdown::Client::RequestGroup#send_notification

Defined in:
lib/lowdown/client/request_group.rb

#send_notification(notification, delegate: nil, context: nil, &block) ⇒ Object

[View source]

22
23
24
25
26
27
28
29
# File 'lib/lowdown/client/request_group.rb', line 22

def send_notification(notification, delegate: nil, context: nil, &block)
  return unless @callbacks.alive?
  if (block.nil? && delegate.nil?) || (block && delegate)
    raise ArgumentError, "Either a delegate object or a block should be provided."
  end
  @callbacks.add(notification.formatted_id, block || delegate)
  @client.send_notification(notification, delegate: @callbacks.async, context: context)
end