lib/rmail/header.rb in rmail-0.17 vs lib/rmail/header.rb in rmail-1.0.0
- old
+ new
@@ -261,11 +261,11 @@
self
end
# Deletes the field at the specified index and returns its value.
def delete_at(index)
- @fields[index, 1] = nil
+ @fields.delete_at(index)
self
end
# Deletes the field if the passed block returns true. Returns
# self.
@@ -280,11 +280,11 @@
# key and value as parameters.
#
# Returns self.
def each # yields: name, value
@fields.each { |i|
- yield(i.name, i.value)
+ yield [i.name, i.value]
}
end
alias each_pair each
# Executes block once for each field in the header, passing the
@@ -830,17 +830,11 @@
# Returns an RMail::Address::List array holding all the recipients
# of this message. This uses the contents of the To, Cc, and Bcc
# fields. Duplicate addresses are eliminated.
def recipients
- retval = RMail::Address::List.new
- retval.concat(to)
- retval.concat(cc)
- retval.concat(bcc)
- retval.uniq
+ RMail::Address::List.new([ to, cc, bcc ].flatten.uniq)
end
-
-# recipients
# Retrieve a given field's value as an RMail::Address::List of
# RMail::Address objects.
#
# This method is used to implement many of the convenience methods