lib/mail/fields/common/parameter_hash.rb in mail-2.6.1 vs lib/mail/fields/common/parameter_hash.rb in mail-2.6.3
- old
+ new
@@ -16,11 +16,11 @@
key_pattern = Regexp.escape(key_name.to_s)
pairs = []
exact = nil
each do |k,v|
if k =~ /^#{key_pattern}(\*|$)/i
- if $1 == '*'
+ if $1 == ASTERISK
pairs << [k, v]
else
exact = k
end
end
@@ -38,20 +38,20 @@
Mail::Encodings.param_decode(string, encoding)
end
end
def encoded
- map.sort { |a,b| a.first.to_s <=> b.first.to_s }.map do |key_name, value|
+ map.sort_by { |a| a.first.to_s }.map! do |key_name, value|
unless value.ascii_only?
value = Mail::Encodings.param_encode(value)
key_name = "#{key_name}*"
end
%Q{#{key_name}=#{quote_token(value)}}
end.join(";\r\n\s")
end
def decoded
- map.sort { |a,b| a.first.to_s <=> b.first.to_s }.map do |key_name, value|
+ map.sort_by { |a| a.first.to_s }.map! do |key_name, value|
%Q{#{key_name}=#{quote_token(value)}}
end.join("; ")
end
end
end