Sha256: a7b23749aaf9fb4b11091d81b97b469220a7f5fedc2a80c44f68a5f7d91ff9af

Contents?: true

Size: 321 Bytes

Versions: 3

Compression:

Stored size: 321 Bytes

Contents

module StreamBot
  # event class
  class Event
    attr_reader :name

    def initialize(name)
      @name = name
    end

    def handle(method=nil, & block)
      @handler = method if method
      @handler = block if block
    end

    def trigger(* args)
      @handler.call(* args) if !@handler.nil?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
streambot-1.0.0.rc3 lib/streambot/event.rb
streambot-1.0.0.rc2 lib/streambot/event.rb
streambot-1.0.0.rc1 lib/streambot/event.rb