Class: Dispatcher::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bas/dispatcher/base.rb

Overview

Serves as a foundational structure for implementing specific dispatchers. Acting as an interface, this class defines essential attributes and methods, providing a blueprint for creating custom dispatchers tailored to different platforms or services.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Base

Initializes the dispatcher with essential configuration parameters.



16
17
18
19
# File 'lib/bas/dispatcher/base.rb', line 16

def initialize(config)
  @webhook = config[:webhook]
  @name = config[:name]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/bas/dispatcher/base.rb', line 12

def name
  @name
end

#webhookObject (readonly)

Returns the value of attribute webhook.



12
13
14
# File 'lib/bas/dispatcher/base.rb', line 12

def webhook
  @webhook
end

Instance Method Details

#dispatch(_payload) ⇒ Object

A method meant to send messages to an specific destination depending on the implementation. Must be overridden by subclasses, with specific logic based on the use case.


returns a Discord::Response



27
28
29
# File 'lib/bas/dispatcher/base.rb', line 27

def dispatch(_payload)
  raise Domain::Exceptions::FunctionNotImplemented
end