lib/turntabler/client.rb
def trigger(command, *args)
      command = command.to_sym if command

      if Event.command?(command)
        event = Event.new(self, command, args)
        handlers = @event_handlers[event.name] || []
        handlers.each do |handler|
          success = handler.run(event)
          handlers.delete(handler) if success && handler.once
        end
      end

      true
    end
def trigger(command, *args)
      command = command.to_sym if command

      if Event.command?(command)
        event = Event.new(self, command, args)
        handlers = @event_handlers[event.name] || []
        handlers.each do |handler|
          success = handler.run(event)
          handlers.delete(handler) if success && handler.once
        end
      end

      true
    end
Triggers callback handlers for the given Turntable command.  This should
 either be invoked when responses are received for Turntable or when
 triggering custom events.

 @note If the command is unknown, it will simply get skipped and not raise an exception
 @param [Symbol] command The name of the command triggered.  This is typically the same name as the event.
 @param [Array] args The arguments to be processed by the event
 @return [true]

 == Triggering custom events

 After defining custom events, `trigger` can be used to invoke any handler
 that's been registered for that event.  The argument list passed into
 `trigger` will be passed, exactly as specified, to the registered
 handlers.

 @example
   # Define names of events
   Turntabler.events(:no_args, :one_arg, :multiple_args)

   # ...

   # Register handlers
   client.on(:no_args) { }
   client.on(:one_arg) {|arg| }
   client.on(:multiple_args) {|arg1, arg2| }

   # Trigger handlers registered for events
   client.trigger(:no_args)              # => true
   client.trigger(:one_arg, 1)           # => true
   client.trigger(:multiple_args, 1, 2)  # => true