Sha256: 5739f3ee807906d1b3c5d7713a78df0d69fcc48214267f87f69395fd6cc8ac52
Contents?: true
Size: 743 Bytes
Versions: 3
Compression:
Stored size: 743 Bytes
Contents
require 'onfire' module Gumdrop::Util module Eventable include ::Onfire def event_block(target) fire "before_#{target}".to_sym data= HashObject.new result= data.payload= yield(data) fire target, data fire "after_#{target}".to_sym, data ret_val= data.return_value || result data.clear() ret_val end def fire(event, data=nil) data= case when data.nil? HashObject.from site:Gumdrop.site when data.is_a?(Hash) HashObject.from(data).merge site:Gumdrop.site else data end event_for(event, self, data).bubble! end def clear_events @event_table ||= Onfire::EventTable.new end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gumdrop-1.1.3 | lib/gumdrop/util/eventable.rb |
gumdrop-1.1.2 | lib/gumdrop/util/eventable.rb |
gumdrop-1.1.1 | lib/gumdrop/util/eventable.rb |