From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.2 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 31AC4201A3 for ; Mon, 13 Apr 2015 01:04:37 +0000 (UTC) Received: from localhost ([::1]:46660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhSnk-0005DT-JY for dtas-all@80x24.org; Sun, 12 Apr 2015 21:04:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhSni-0005C4-4b for dtas-all@nongnu.org; Sun, 12 Apr 2015 21:04:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YhSnh-0002zT-3m for dtas-all@nongnu.org; Sun, 12 Apr 2015 21:04:34 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:36049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhSng-0002xR-UV for dtas-all@nongnu.org; Sun, 12 Apr 2015 21:04:33 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5E46320148 for ; Mon, 13 Apr 2015 01:04:28 +0000 (UTC) From: Eric Wong To: Subject: [PATCH 3/3] cleanup: avoid redundant Array conversion for escapes Date: Mon, 13 Apr 2015 01:04:24 +0000 Message-Id: <1428887064-18715-4-git-send-email-e@80x24.org> In-Reply-To: <1428887064-18715-1-git-send-email-e@80x24.org> References: <1428887064-18715-1-git-send-email-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org We already convert xs arg to be an Array, so avoid bloating our code with redundancy. --- bin/dtas-cueedit | 4 ++-- lib/dtas/player.rb | 2 +- lib/dtas/player/client_handler.rb | 2 +- lib/dtas/process.rb | 2 +- lib/dtas/splitfx.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/dtas-cueedit b/bin/dtas-cueedit index a2056d3..603bf28 100755 --- a/bin/dtas-cueedit +++ b/bin/dtas-cueedit @@ -49,7 +49,7 @@ ARGV.each do |file| # avoid an expensive update if the user didn't change anything current = File.binread(tmp.path) if current == original - $stderr.puts "tags for #{xs(Array(file))} unchanged" if $DEBUG + $stderr.puts "tags for #{xs(file)} unchanged" if $DEBUG next end @@ -65,7 +65,7 @@ ARGV.each do |file| warn err_msg(cmd, $?) warn "E: restoring original from backup" x!(*%W(metaflac --import-cuesheet-from=#{backup.path} #{file})) - warn "E: backup cuesheet restored, #{xs(Array(file))} unchanged" + warn "E: backup cuesheet restored, #{xs(file)} unchanged" exit(false) end ensure diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb index ea04dca..cdf1265 100644 --- a/lib/dtas/player.rb +++ b/lib/dtas/player.rb @@ -60,7 +60,7 @@ class DTAS::Player # :nodoc: end def wall(msg) - __wall(xs(Array(msg))) + __wall(xs(msg)) end def __wall(msg) diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb index a867265..b04872b 100644 --- a/lib/dtas/player/client_handler.rb +++ b/lib/dtas/player/client_handler.rb @@ -535,7 +535,7 @@ module DTAS::Player::ClientHandler # :nodoc: begin sf.dump(self) rescue => e - return io.emit("ERR dumping to #{xs(Array(dest))} #{e.message}") + return io.emit("ERR dumping to #{xs(dest)} #{e.message}") end end io.emit("OK") diff --git a/lib/dtas/process.rb b/lib/dtas/process.rb index ab4b2d5..5be107f 100644 --- a/lib/dtas/process.rb +++ b/lib/dtas/process.rb @@ -99,6 +99,6 @@ module DTAS::Process # :nodoc: _, status = Process.waitpid2(pid) return res if status.success? return status if no_raise - raise RuntimeError, "`#{xs(Array(cmd))}' failed: #{status.inspect}" + raise RuntimeError, "`#{xs(cmd)}' failed: #{status.inspect}" end end diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb index fcd0028..6271fb0 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -298,7 +298,7 @@ class DTAS::SplitFX # :nodoc: samples = @t2s.call(stop_time) prev = @tracks.last and prev.commit(samples) else - raise ArgumentError, "unknown command: #{xs(Array(cmd))}" + raise ArgumentError, "unknown command: #{xs(cmd)}" end end -- EW