Sha256: 23a8e620fd5c1dac08c56bcb4458d610d319c4785f7c999750d22c27374733af
Contents?: true
Size: 791 Bytes
Versions: 27
Compression:
Stored size: 791 Bytes
Contents
# frozen_string_literal: true module Discorb # # Represents a event. # This class shouldn't be instantiated directly. # Use {Client#on} instead. # class Event # @return [Proc] the block to be called. attr_reader :block # @return [Symbol] the event id. attr_reader :id # @return [Hash] the event discriminator. attr_reader :discriminator # @return [Boolean] whether the event is once or not. attr_reader :once alias once? once def initialize(block, id, discriminator) @block = block @id = id @once = discriminator.fetch(:once, false) @discriminator = discriminator @rescue = nil end # # Calls the block associated with the event. # def call(...) @block.call(...) end end end
Version data entries
27 entries across 27 versions & 1 rubygems