Class: MPD::Song
- Inherits:
-
Hash
- Object
- Hash
- MPD::Song
- Defined in:
- lib/librmpd.rb
Overview
Song
This class is a glorified Hash used to represent a song You can access the various fields of a song (such as title) by either the normal hash method (song) or by using the field as a method name (song.title).
If the field doesn't exist or isn't set, nil will be returned
Instance Method Summary (collapse)
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(m, *a)
194 195 196 197 198 199 200 201 202 203 |
# File 'lib/librmpd.rb', line 194 def method_missing(m, *a) key = m.to_s if key =~ /=$/ self[$`] = a[0] elsif a.empty? self[key] else raise NoMethodError, "#{m}" end end |