class Discordrb::Events::Event
Generic event class that can be extended
Attributes
bot[R]
@return [Bot] the bot used to initialize this event.
Protected Class Methods
delegate(*methods, hash)
click to toggle source
Delegates a list of methods to a particular object. This is essentially a reimplementation of ActiveSupport's `#delegate`, but without the overhead provided by the rest. Used in subclasses of `Event` to delegate properties on events to properties on data objects. @param methods [Array<Symbol>] The methods to delegate. @param hash [Hash<Symbol => Symbol>] A hash with one `:to` key and the value the method to be delegated to.
# File lib/discordrb/events/generic.rb, line 65 def delegate(*methods, hash) methods.each do |e| define_method(e) do object = __send__(hash[:to]) object.__send__(e) end end end