summaryrefslogtreecommitdiff
path: root/libmpd/playbackoptions.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-07-06 16:09:47 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-07-06 16:09:47 -0700
commit602cbf21d35ba898841cac0f3c458bd90b6b6841 (patch)
tree0d8b282562d866ff70d833666a383a50d6714f4e /libmpd/playbackoptions.rb
parent4ebf4d0b5e8de5a79efa3811eb35ac8b85f26b07 (diff)
downloadruby-libmpd-602cbf21d35ba898841cac0f3c458bd90b6b6841.tar.gz
ruby-libmpd-602cbf21d35ba898841cac0f3c458bd90b6b6841.tar.xz
Style changes and simpler code.
Diffstat (limited to 'libmpd/playbackoptions.rb')
-rw-r--r--libmpd/playbackoptions.rb38
1 files changed, 17 insertions, 21 deletions
diff --git a/libmpd/playbackoptions.rb b/libmpd/playbackoptions.rb
index f9d39ec..84afd47 100644
--- a/libmpd/playbackoptions.rb
+++ b/libmpd/playbackoptions.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
#
#--
-# Copyright 2009 David Vazgenovich Shakaryan <dvshakaryan@gmail.com>
+# Copyright 2009-2014 David Vazgenovich Shakaryan <dvshakaryan@gmail.com>
# Distributed under the terms of the GNU General Public License v3.
# See http://www.gnu.org/licenses/gpl.txt for the full license text.
#++
@@ -16,65 +16,62 @@ module MPDPlaybackOptions
#
# Accepts an argument of +true+ to enable or +false+ to disable.
# If no argument is given, defaults to +true+.
- def consume(state=true)
- return send_request('consume %s' % state.to_i)
+ def consume(state = true)
+ send_request('consume %s' % state.to_i)
end
# Returns +true+ if consume is activated.
# Otherwise, returns +false+.
def consume?
- return true if status[:consume] == '1'
- return false
+ status[:consume] == '1'
end
# Sets crossfading between songs.
def crossfade(seconds)
- return send_request('crossfade %s' % seconds)
+ send_request('crossfade %s' % seconds)
end
# Returns the current crossfade setting as an integer.
def crossfade?
- return status[:xfade].to_i
+ status[:xfade].to_i
end
# Sets random state.
#
# Accepts an argument of +true+ to enable or +false+ to disable.
# If no argument is given, defaults to +true+.
- def random(state=true)
- return send_request('random %s' % state.to_i)
+ def random(state = true)
+ send_request('random %s' % state.to_i)
end
# Returns +true+ if random is activated.
# Otherwise, returns +false+.
def random?
- return true if status[:random] == '1'
- return false
+ status[:random] == '1'
end
# Sets repeat state.
#
# Accepts an argument of +true+ to enable or +false+ to disable.
# If no argument is given, defaults to +true+.
- def repeat(state=true)
- return send_request('repeat %s' % state.to_i)
+ def repeat(state = true)
+ send_request('repeat %s' % state.to_i)
end
# Returns +true+ if repeat is activated.
# Otherwise, returns +false+.
def repeat?
- return true if status[:repeat] == '1'
- return false
+ status[:repeat] == '1'
end
# Sets volume from a range of 0 to 100.
def volume(volume)
- return send_request('setvol %s' % volume)
+ send_request('setvol %s' % volume)
end
# Returns the current volume as an integer.
def volume?
- return status[:volume].to_i
+ status[:volume].to_i
end
# Sets single state.
@@ -83,14 +80,13 @@ module MPDPlaybackOptions
#
# Accepts an argument of +true+ to enable or +false+ to disable.
# If no argument is given, defaults to +true+.
- def single(state=true)
- return send_request('single %s' % state.to_i)
+ def single(state = true)
+ send_request('single %s' % state.to_i)
end
# Returns +true+ if single is activated.
# Otherwise, returns +false+.
def single?
- return true if status[:single] == '1'
- return false
+ status[:single] == '1'
end
end