summaryrefslogtreecommitdiff
path: root/libmpd.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-23 18:25:32 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-23 18:25:32 -0700
commitab7494d42eae74133e6cf6d4d6c85aeaecf19939 (patch)
treee24044f09029aaee4907b2bbe92efe70ad54e2c3 /libmpd.rb
parent7a5adb16225e564e06618539a24c0da818adf2c2 (diff)
downloadruby-libmpd-ab7494d42eae74133e6cf6d4d6c85aeaecf19939.tar.gz
ruby-libmpd-ab7494d42eae74133e6cf6d4d6c85aeaecf19939.tar.xz
Add to_i method to true and false objects.
Diffstat (limited to 'libmpd.rb')
-rw-r--r--libmpd.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/libmpd.rb b/libmpd.rb
index d211e71..89702b3 100644
--- a/libmpd.rb
+++ b/libmpd.rb
@@ -6,6 +6,20 @@
require 'socket'
+class TrueClass
+ # Return integer 1.
+ def to_i
+ return 1
+ end
+end
+
+class FalseClass
+ # Return integer 0.
+ def to_i
+ return 0
+ end
+end
+
class MPD
# Initialise an MPD object with the specified host and port.
#
@@ -85,7 +99,7 @@ class MPD
return send_request command
end
- # Toggles pause. (1 = pause, 0 = play)
+ # Toggles pause.
def pause pause
return send_request 'pause ' + pause.to_s
end