about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-12-06 10:03:40 +0000
committerEric Wong <normalperson@yhbt.net>2013-12-06 10:03:40 +0000
commitf383a08ddbc45a8507eaf9f1654e25d6ea26e108 (patch)
tree1411f1723e0d5cd2998ae1fb21f3d0a4c7ea3fe2 /lib
parent11a0b07cde0a622f5bfd430b7b78e9994467c850 (diff)
downloaddtas-f383a08ddbc45a8507eaf9f1654e25d6ea26e108.tar.gz
client_handler: style: prefer terser &:method form
We are Ruby 1.9+ only, so shorten our code just a little
and hopefully make things easier-to-read.
Diffstat (limited to 'lib')
-rw-r--r--lib/dtas/player/client_handler.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index 010f6eb..ef87446 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -265,7 +265,7 @@ module DTAS::Player::ClientHandler # :nodoc:
   end
 
   def active_sinks
-    sinks = @targets.map { |t| t.sink }
+    sinks = @targets.map(&:sink)
     sinks.uniq!
     sinks
   end
@@ -588,7 +588,7 @@ module DTAS::Player::ClientHandler # :nodoc:
       io.emit("#{res.size} #{res.join(' ')}")
     when "tracks"
       tracks = @tl.tracks
-      io.emit("#{tracks.size} " << tracks.map! { |i| i.to_s }.join(' '))
+      io.emit("#{tracks.size} " << tracks.map!(&:to_s).join(' '))
     when "goto"
       track_id = msg.shift or return io.emit("ERR track_id not specified")
       offset = msg.shift # may be nil
@@ -660,7 +660,7 @@ module DTAS::Player::ClientHandler # :nodoc:
       bp = cur.cuebreakpoints
       case msg[0]
       when nil
-        tmp = { "infile" => cur.infile, "cue" => bp.map { |ci| ci.to_hash } }
+        tmp = { "infile" => cur.infile, "cue" => bp.map(&:to_hash) }
         io.emit(tmp.to_yaml)
       when "next", "prev"
         return __bp_prev_next(io, msg, cur, bp)