Class: MPD::Controller::Database::Element
- Inherits:
-
Object
- Object
- MPD::Controller::Database::Element
- Defined in:
- lib/mpd/controller/database.rb
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
-
#initialize(database, tag, name) ⇒ Element
constructor
A new instance of Element.
- #inspect ⇒ Object
- #nil? ⇒ Boolean
- #songs(strict = false) ⇒ Object
Constructor Details
#initialize(database, tag, name) ⇒ Element
Returns a new instance of Element.
161 162 163 164 165 |
# File 'lib/mpd/controller/database.rb', line 161 def initialize (database, tag, name) @database = database @tag = tag @name = name end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
159 160 161 |
# File 'lib/mpd/controller/database.rb', line 159 def database @database end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
159 160 161 |
# File 'lib/mpd/controller/database.rb', line 159 def name @name end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
159 160 161 |
# File 'lib/mpd/controller/database.rb', line 159 def tag @tag end |
Instance Method Details
#inspect ⇒ Object
175 176 177 |
# File 'lib/mpd/controller/database.rb', line 175 def inspect "#<#{self.class.name.sub(/::Element$/, "::#{tag.capitalize}")}: #{name.inspect}>" end |
#nil? ⇒ Boolean
167 168 169 |
# File 'lib/mpd/controller/database.rb', line 167 def nil? name.empty? end |
#songs(strict = false) ⇒ Object
171 172 173 |
# File 'lib/mpd/controller/database.rb', line 171 def songs (strict = false) database.search(name, tag: tag, strict: strict) end |