about summary refs log tree commit homepage
path: root/lib/dtas/player.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-10-05 22:20:00 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-05 22:20:00 +0000
commit1b680f0b124c0fe7b2aae48543643090c967ad44 (patch)
tree97091457c7bbed7c4ad7daa94529e75e14e4de93 /lib/dtas/player.rb
parent253b910f920d1916ca44f2617221fd54ad219821 (diff)
downloaddtas-1b680f0b124c0fe7b2aae48543643090c967ad44.tar.gz
The addition of a "need_to_queue" method should reduce the amount of
cognitive overhead required to parse these conditions
Diffstat (limited to 'lib/dtas/player.rb')
-rw-r--r--lib/dtas/player.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb
index efefcbf..f94c575 100644
--- a/lib/dtas/player.rb
+++ b/lib/dtas/player.rb
@@ -165,9 +165,13 @@ class DTAS::Player # :nodoc:
     rv
   end
 
+  def need_to_queue
+    @current || @queue[0] || @paused
+  end
+
   def enq_handler(io, msg)
     # check @queue[0] in case we have no sinks
-    if @current || @queue[0] || @paused
+    if need_to_queue
       @queue << msg
     else
       next_source(msg)
@@ -177,7 +181,7 @@ class DTAS::Player # :nodoc:
 
   def do_enq_head(io, msg)
     # check @queue[0] in case we have no sinks
-    if @current || @queue[0] || @paused
+    if need_to_queue
       @queue.unshift(msg)
     else
       next_source(msg)