Class: MPD::Controller::Commands
- Inherits:
-
Object
- Object
- MPD::Controller::Commands
- Includes:
- Enumerable
- Defined in:
- lib/mpd/controller/commands.rb
Defined Under Namespace
Classes: Command
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(controller) ⇒ Commands
constructor
A new instance of Commands.
- #inspect ⇒ Object
Constructor Details
#initialize(controller) ⇒ Commands
Returns a new instance of Commands.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mpd/controller/commands.rb', line 31 def initialize (controller) @controller = controller @commands = [] controller.do_and_raise_if_needed(:commands).each {|_, name| @commands << Command.new(name) } controller.do_and_raise_if_needed(:notcommands).each {|_, name| @commands << Command.new(name, false) } end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
29 30 31 |
# File 'lib/mpd/controller/commands.rb', line 29 def controller @controller end |
Instance Method Details
#each(&block) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/mpd/controller/commands.rb', line 44 def each (&block) return to_enum unless block_given? @commands.each(&block) self end |
#inspect ⇒ Object
52 53 54 |
# File 'lib/mpd/controller/commands.rb', line 52 def inspect "#<#{self.class.name}: #{map {|c| "#{'-' unless c.usable?}#{c.name}"}.join ' '}>" end |