lib/em-ssh/callbacks.rb
# Register a callback to be fired when a matching event occurs.
# The callback will be fired when the event occurs until it returns true.
# @param [Symbol] event
Register a callback to be fired when a matching event occurs.
The callback will be fired when the event occurs until it returns true.
Register a callback to be fired when a matching event occurs . The callback will be fired when the event occurs until it returns true .
def on(event, &blk)
        if block_given?
          raise "event (#{event.inspect}) must be a symbol when a block is given" unless event.is_a?(Symbol)
          return Callback.new(self, event, &blk).tap{|cb| (callbacks[event] ||= []).push(cb) }
        end 
        raise "event (#{event.inspect}) must be a Callback when a block is not given" unless event.is_a?(Callback)
        (callbacks[event] ||= []).push(event)
        return event
      end
def on ( event , & blk ) if block_given? raise "event (#{event.inspect}) must be a symbol when a block is given" unless event . is_a? ( Symbol ) return Callback . new ( self , event , & blk ) . tap { | cb | ( callbacks [ event ] ||= [ ] ) . push ( cb ) } end raise "event (#{event.inspect}) must be a Callback when a block is not given" unless event . is_a? ( Callback ) ( callbacks [ event ] ||= [ ] ) . push ( event ) return event end
Register a callback to be fired when a matching event occurs.
Register a callback to be fired when a matching event occurs .
#log.debug("#{self}.on(#{event.inspect}, #{blk})") # block_given?
event
<not_specific>
blk
<not_specific>
<not_specific>
None