Class: Conquer::Mpd::Listener
- Inherits:
-
Object
- Object
- Conquer::Mpd::Listener
- Includes:
- Celluloid, Celluloid::Notifications
- Defined in:
- lib/conquer/mpd.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Listener
constructor
A new instance of Listener.
- #run ⇒ Object
Constructor Details
#initialize(*args) ⇒ Listener
Returns a new instance of Listener.
16 17 18 19 20 21 22 |
# File 'lib/conquer/mpd.rb', line 16 def initialize(*args) = args.last.is_a?(Hash) ? args.pop : {} @host = args.any? ? args.join(':') : nil @mpd = INSTANCES[args] @events = [:events] async.run end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/conquer/mpd.rb', line 24 def run publish(:mpd, @mpd) loop do `mpc #{"-h #{@host}" if @host} idle #{@events.join(' ')}` publish(:mpd, @mpd) end end |