From 2f4f1f81f37f264342f0e1d48325e0a835049859 Mon Sep 17 00:00:00 2001 From: Guillaume DOTT Date: Tue, 10 Sep 2013 15:56:37 +0200 Subject: [PATCH] Modify Hayes#messages to always return an array --- lib/biju/hayes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/biju/hayes.rb b/lib/biju/hayes.rb index 6c7589a..aa5ea37 100644 --- a/lib/biju/hayes.rb +++ b/lib/biju/hayes.rb @@ -76,7 +76,7 @@ module Biju sms = at_command('+CMGL', which) - return sms[:status] if !sms.has_key?(:sms) || sms[:sms].empty? + return [] unless sms.has_key?(:sms) sms[:sms].map do |msg| Biju::Sms.from_pdu(msg[:message].chomp, msg[:infos][0]) end @@ -103,9 +103,9 @@ module Biju res = ATTransform.new.apply(ATParser.new.parse(str)) case res[:cmd] - when "+CMS ERROR" + when '+CMS ERROR' raise AT::CmsError.new(res[:result]) - when "+CME ERROR" + when '+CME ERROR' raise AT::CmeError.new(res[:result]) end