async-matrixSourceAsyncDiscordApiGateway

class Gateway

Gateway produces Chain instances bound to a specific Discord Client. Each call to a method on the Gateway starts a new chain.

Definitions

def chain

Start a fresh chain. Every method call on the gateway creates a new chain so chains are never reused.

Implementation

def chain
  Async::Matrix::Api::Chain.new(
    client: @client,
    path_tree: Api.path_tree,
    prefix: @prefix
  )
end

def method_missing(name, *args, **kwargs, &block)

Forward all unknown methods to a fresh chain, starting the path.

Implementation

def method_missing(name, *args, **kwargs, &block)
  if name.start_with?("to_")
    super
  else
    chain.__send__(name, *args, **kwargs, &block)
  end
end