Sha256: b9777ba55be44b683b50754acbc3804b0246e5cdb966c2fdf7e44f1e50027955
Contents?: true
Size: 496 Bytes
Versions: 3
Compression:
Stored size: 496 Bytes
Contents
module Mac module EventMonitor class Monitor def initialize @listeners = {} end def add_listener(type, &block) @listeners[type] ||= [] @listeners[type] << block end def run(stop_after = nil) run_app(stop_after) end def receive_event(str) event = Event.create_from_description(str) (@listeners[event.type] || []).each do |block| block.call(event) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mac-event-monitor-0.1.0 | lib/mac-event-monitor/monitor.rb |
mac-event-monitor-0.0.3 | lib/mac-event-monitor/monitor.rb |
mac-event-monitor-0.0.2 | lib/mac-event-monitor/monitor.rb |