Sha256: 5d9ccc70781b5024c052c0dc0a43adaf5e0e01a58fbebca1ebd927f0644e186f

Contents?: true

Size: 736 Bytes

Versions: 4

Compression:

Stored size: 736 Bytes

Contents

module Onfire
  # An Event is born in #fire and is passed up the ancestor chain of the triggering datastructure.
  # It carries a <tt>type</tt>, the fireing widget <tt>source</tt> and arbitrary payload <tt>data</tt>.
  class Event
    
    attr_accessor :type, :source, :data
    
    def initialize(type=nil, source=nil, data=nil)
      @type       = type
      @source     = source
      @data       = data
    end
    
    def stopped?
      @stopped ||= false
    end
    
    # Stop event bubbling.
    def stop!
      @stopped = true
    end
    
    ### FIXME: what about serialization? should we simply forget the source?
    def _dump(depth)
      ""
    end
    def self._load(str)
      ::Onfire::Event.new
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
onfire-0.1.2 lib/onfire/event.rb
onfire-0.1.1 lib/onfire/event.rb
nilclass-onfire-0.1.1.nc lib/onfire/event.rb
onfire-0.1.0 lib/onfire/event.rb