Class: MPD::Song
Overview
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
Methods inherited from Hash
file, #ids, #rwd_table, #save, #subset, #to_i
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a) ⇒ Object
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/librmpd.rb', line 191 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 |