diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-07-23 19:29:31 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-07-23 19:29:31 -0700 |
commit | cff0409822f20022d82280f2f50305c4b4ebce85 (patch) | |
tree | c01001571aa279b37abdf0bf016100916b93f744 /libmpd.rb | |
parent | d3c4f79699a00d32393ae02116404113599f0c6b (diff) | |
download | ruby-libmpd-cff0409822f20022d82280f2f50305c4b4ebce85.tar.gz ruby-libmpd-cff0409822f20022d82280f2f50305c4b4ebce85.tar.xz |
Add paused?, playing?, and stopped? methods.
Diffstat (limited to 'libmpd.rb')
-rw-r--r-- | libmpd.rb | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -216,6 +216,27 @@ class MPD return send_request 'single %s' % state.to_i end + # Returns +true+ if playing. + # Otherwise, returns +false+. + def playing? + return true if status[:state] == 'play' + return false + end + + # Returns +true+ if paused. + # Otherwise, returns +false+. + def paused? + return true if status[:state] == 'pause' + return false + end + + # Returns +true+ if stopped. + # Otherwise, returns +false+. + def stopped? + return true if status[:state] == 'stop' + return false + end + private :generate_hash private :get_response private :split_and_hash |