Class: MPD::Controller::Do
- Inherits:
- BasicObject
- Defined in:
- lib/mpd/controller/do.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
-
#initialize(controller, &block) ⇒ Do
constructor
A new instance of Do.
- #method_missing(id, *args) ⇒ Object
- #send ⇒ Object
Constructor Details
#initialize(controller, &block) ⇒ Do
Returns a new instance of Do.
16 17 18 19 20 21 |
# File 'lib/mpd/controller/do.rb', line 16 def initialize (controller, &block) @controller = controller @commands = [] instance_exec &block if block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
14 15 16 |
# File 'lib/mpd/controller/do.rb', line 14 def controller @controller end |
Instance Method Details
#send ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mpd/controller/do.rb', line 27 def send result = [] controller.puts ::MPD::Protocol::CommandList.new(@commands).to_s @commands.each {|command| result << ::MPD::Protocol::Response.read(controller, command) break if result.last.is_a? ::MPD::Protocol::Error } and controller.readline result end |