From ab7494d42eae74133e6cf6d4d6c85aeaecf19939 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Thu, 23 Jul 2009 18:25:32 -0700 Subject: Add to_i method to true and false objects. --- libmpd.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2