Class: MPD::Controller::Database::Directory
- Inherits:
-
Object
- Object
- MPD::Controller::Database::Directory
- Includes:
- Enumerable
- Defined in:
- lib/mpd/controller/database.rb
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #each ⇒ Object
-
#initialize(database, uri = nil) ⇒ Directory
constructor
A new instance of Directory.
- #inspect ⇒ Object
Constructor Details
#initialize(database, uri = nil) ⇒ Directory
Returns a new instance of Directory.
108 109 110 111 |
# File 'lib/mpd/controller/database.rb', line 108 def initialize (database, uri = nil) @database = database @uri = uri end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
106 107 108 |
# File 'lib/mpd/controller/database.rb', line 106 def database @database end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
106 107 108 |
# File 'lib/mpd/controller/database.rb', line 106 def uri @uri end |
Instance Method Details
#[](name) ⇒ Object
126 127 128 129 130 |
# File 'lib/mpd/controller/database.rb', line 126 def [] (name) each { |n| return n if n.uri == name } nil end |
#each ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/mpd/controller/database.rb', line 113 def each return enum_for :each unless block_given? database.controller.do_and_raise_if_needed(:lsinfo, *uri).each {|name, value| case name when :file then yield Song.from_uri(value, database.controller) when :directory then yield Directory.new(database, value) end } self end |
#inspect ⇒ Object
132 133 134 |
# File 'lib/mpd/controller/database.rb', line 132 def inspect "#<#{self.class.name}: #{uri.inspect}>" end |