From a2f9808c754acca0d59cae3974809a82a2dcc978 Mon Sep 17 00:00:00 2001 From: Samuel Cochran Date: Wed, 25 Jul 2012 11:47:12 +0800 Subject: [PATCH] Some syntax bits --- lib/mail_catcher.rb | 2 +- lib/mail_catcher/mail.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mail_catcher.rb b/lib/mail_catcher.rb index 8e59ef1..ff95b48 100644 --- a/lib/mail_catcher.rb +++ b/lib/mail_catcher.rb @@ -185,7 +185,7 @@ module_function rescue RuntimeError if $!.to_s =~ /\bno acceptor\b/ puts "~~> ERROR: Something's using port #{port}. Are you already running MailCatcher?" - exit -1 + exit(-1) else raise end diff --git a/lib/mail_catcher/mail.rb b/lib/mail_catcher/mail.rb index 07cf516..36f4630 100644 --- a/lib/mail_catcher/mail.rb +++ b/lib/mail_catcher/mail.rb @@ -43,7 +43,7 @@ module_function @@add_message_query ||= db.prepare("INSERT INTO message (sender, recipients, subject, source, type, size, created_at) VALUES (?, ?, ?, ?, ?, ?, datetime('now'))") mail = Mail.new(message[:source]) - result = @@add_message_query.execute(message[:sender], message[:recipients].to_json, mail.subject, message[:source], mail.mime_type || 'text/plain', message[:source].length) + @@add_message_query.execute(message[:sender], message[:recipients].to_json, mail.subject, message[:source], mail.mime_type || 'text/plain', message[:source].length) message_id = db.last_insert_row_id parts = mail.all_parts parts = [mail] if parts.empty? @@ -139,7 +139,7 @@ module_function def message_part_cid(message_id, cid) @@message_part_cid_query ||= db.prepare 'SELECT * FROM message_part WHERE message_id = ?' @@message_part_cid_query.execute(message_id).map do |row| - part = Hash[row.fields.zip(row)] + Hash[row.fields.zip(row)] end.find do |part| part["cid"] == cid end