Sha256: 647af8f387e6b85f327d15d635049fb73bde627a31ed7be35dfb2696140b494b
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require 'eventmachine-swinsian/version' require 'eventmachine-distributed-notification' module EventMachine class SwinsianWatch < DistributedNotificationWatch ACTION_PLAYING = 'com.swinsian.Swinsian-Track-Playing' ACTION_PAUSED = 'com.swinsian.Swinsian-Track-Paused' ACTION_STOPPED = 'com.swinsian.Swinsian-Track-Stopped' def notify(name, user_info) case name when ACTION_PLAYING on_play(user_info) when ACTION_PAUSED on_pause(user_info) when ACTION_STOPPED on_stop(user_info) end end def on_play(user_info); end def on_pause(user_info); end def on_stop(user_info); end end def self.watch_swinsian(handler = nil, *args, &block) args = [ [ SwinsianWatch::ACTION_PLAYING, SwinsianWatch::ACTION_PAUSED, SwinsianWatch::ACTION_STOPPED ], *args ] klass = klass_from_handler(EventMachine::SwinsianWatch, handler, *args); c = klass.new(*args, &block) c.start yield c if block_given? c end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eventmachine-swinsian-0.0.1 | lib/eventmachine-swinsian.rb |