mail 1.3.5 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mail might be problematic. Click here for more details.

data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ == Sun Dec 27 09:51:27 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
2
+
3
+ * Version bump to 1.4 because now :to_s calls :decoded for all fields and body while
4
+ :to_s calls :encoded for Message and Header containers. Makes sense... really.
5
+
1
6
  == Sun Dec 27 07:30:02 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
2
7
 
3
8
  * Changed fields to default to :decoded on :to_s, all container objects retain :encoded as the default for :to_s
data/README.rdoc CHANGED
@@ -113,8 +113,8 @@ I have tried to simplify it some:
113
113
  3. By default, calling :to_s on a container object will call it's encoded method, while
114
114
  :to_s on a field object will call it's decoded method. So calling :to_s on a Mail
115
115
  object will return the mail, all encoded ready to send, while calling :to_s on the
116
- From field will return the decoded value of the field. The body and headers of Mail
117
- objects are considered containers. If you are in doubt, call :encoded, or :decoded
116
+ From field or the body will return the decoded value of the object. The header object
117
+ of Mail is considered a container. If you are in doubt, call :encoded, or :decoded
118
118
  explicitly, this is safer if you are not sure.
119
119
 
120
120
  4. Structured fields that have parameter values that can be encoded (e.g. Content-Type) will
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ require 'bundler'
12
12
 
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = "mail"
15
- s.version = "1.3.5"
15
+ s.version = "1.4.0"
16
16
  s.author = "Mike Lindsaar"
17
17
  s.email = "raasdnil@gmail.com"
18
18
  s.homepage = "http://github.com/mikel/mail"
data/lib/mail/body.rb CHANGED
@@ -97,16 +97,13 @@ module Mail
97
97
  # raw source. Need to implement
98
98
  def encoded
99
99
  if multipart?
100
- encoded_parts = parts.map { |p| p.to_s }
100
+ encoded_parts = parts.map { |p| p.encoded }
101
101
  ([preamble] + encoded_parts).join(crlf_boundary) + end_boundary + epilogue.to_s
102
102
  else
103
103
  raw_source.to_crlf
104
104
  end
105
105
  end
106
106
 
107
- alias :to_s :encoded
108
-
109
- # Returns the raw source right now. Need to implement
110
107
  def decoded
111
108
  if encoding.nil? || !Encodings.defined?(encoding)
112
109
  raw_source.to_lf
@@ -115,6 +112,10 @@ module Mail
115
112
  end
116
113
  end
117
114
 
115
+ def to_s
116
+ decoded
117
+ end
118
+
118
119
  def charset
119
120
  @charset
120
121
  end
data/lib/mail/header.rb CHANGED
@@ -165,7 +165,13 @@ module Mail
165
165
  buffer
166
166
  end
167
167
 
168
- alias :to_s :encoded
168
+ def to_s
169
+ encoded
170
+ end
171
+
172
+ def decoded
173
+ raise NoMethodError, 'Can not decode an entire header as there could be character set conflicts, try calling #decoded on the various fields.'
174
+ end
169
175
 
170
176
  # Returns true if the header has a Message-ID defined (empty or not)
171
177
  def has_message_id?
data/lib/mail/message.rb CHANGED
@@ -764,8 +764,10 @@ module Mail
764
764
  buffer
765
765
  end
766
766
 
767
- alias :to_s :encoded
768
-
767
+ def to_s
768
+ encoded
769
+ end
770
+
769
771
  def decoded
770
772
  raise NoMethodError, 'Can not decode an entire message, try calling #decoded on the various fields and body or parts if it is a multipart message.'
771
773
  end
@@ -900,7 +902,7 @@ module Mail
900
902
  if filename = attachment?
901
903
  encoding = content_transfer_encoding.encoding if content_transfer_encoding
902
904
  @attachment = Mail::Attachment.new(:filename => filename,
903
- :data => body.to_s,
905
+ :data => body.encoded,
904
906
  :encoding => encoding)
905
907
  end
906
908
  end
data/lib/mail/version.rb CHANGED
@@ -2,8 +2,8 @@
2
2
  module Mail
3
3
  module VERSION
4
4
  MAJOR = 1
5
- MINOR = 3
6
- TINY = 5
5
+ MINOR = 4
6
+ TINY = 0
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Lindsaar