Class MUES::CallbackEvent
In: lib/mues/events/systemevents.rb  (CVS)
Parent: SystemEvent

An event class which encapsulates a callback of some kind. It is used when a callback should be executed asynchronously, such as a repeating or scheduled call to a timer or heartbeat function that operates at a different interval than the Engine‘s TickEvent. It derives from the MUES::SystemEvent class.

Methods

call   new  

Attributes

args  [RW]  The callback‘s argument array.
callback  [RW]  The callback (a Proc or Method object).

Public Class methods

Create and return a new CallbackEvent with the specified callback (a Proc or a Method object), which will be called with the specified arguments.

[Source]

# File lib/mues/events/systemevents.rb, line 366
        def initialize( callback, *args )
            checkType( callback, Proc, Method )
            @callback = callback
            @args = args
            super()
        end

Public Instance methods

Call the callback with the args given at instantiation.

[Source]

# File lib/mues/events/systemevents.rb, line 385
        def call
            @callback.call( *@args )
        end

[Validate]