From 3656fd6d821af39c1733ec0460e78d5d54015e4e Mon Sep 17 00:00:00 2001 From: Guillaume DOTT Date: Thu, 3 Oct 2013 11:11:21 +0200 Subject: [PATCH] Allow for an id or an enumerable for Biju::Hayes#delete --- lib/biju/hayes.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/biju/hayes.rb b/lib/biju/hayes.rb index 2304e89..cc6a61a 100644 --- a/lib/biju/hayes.rb +++ b/lib/biju/hayes.rb @@ -105,7 +105,13 @@ module Biju # Delete a sms message by id. # @param [Fixnum] Id of sms message on modem. def delete(id) - at_command('+CMGD', id) + id = [id] if id.kind_of?(Fixnum) + return unless id.kind_of?(Enumerable) + + res = true + id.each { |i| res &= at_command('+CMGD', i)[:status] } + + res end def send(sms, options = {})