From 6c06185c7267567fe1237737342d3d8059d4bfc3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 25 Jan 2016 09:56:53 +0000 Subject: mlib: use more appropriate methods .each on a Sequel dataset is more appropriate for the way we emit comments. And using Array#map! is more efficient when we do not need the original array. --- lib/dtas/mlib.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dtas/mlib.rb b/lib/dtas/mlib.rb index ffd0cc3..09856ee 100644 --- a/lib/dtas/mlib.rb +++ b/lib/dtas/mlib.rb @@ -67,7 +67,7 @@ class DTAS::Mlib # :nodoc: def init_suffixes `sox --help 2>/dev/null` =~ /\nAUDIO FILE FORMATS:\s*([^\n]+)/s - re = $1.split(/\s+/).map { |x| Regexp.quote(x) }.join('|') + re = $1.split(/\s+/).map! { |x| Regexp.quote(x) }.join('|') @suffixes = Regexp.new("\\.(?:#{re}|yml)\\z", Regexp::IGNORECASE) end @@ -428,7 +428,7 @@ class DTAS::Mlib # :nodoc: comments = Hash.new { |h,k| h[k] = [] } @db['SELECT c.tag_id, v.val FROM comments c ' \ 'LEFT JOIN vals v ON v.id = c.val_id ' \ - "WHERE c.node_id = #{node[:id]} ORDER BY c.tag_id"].map do |c| + "WHERE c.node_id = #{node[:id]} ORDER BY c.tag_id"].each do |c| comments[@tag_rmap[c[:tag_id]]] << c[:val] end cb.call(parent, node, comments) -- cgit v1.2.3-24-ge0c7