mail_builder 0.1 → 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require 'rake'
2
3
  require 'rake/testtask'
3
4
 
@@ -23,13 +24,14 @@ require "rake/gempackagetask"
23
24
 
24
25
  NAME = "mail_builder"
25
26
  SUMMARY = "MailBuilder is a simple library for building RFC compliant MIME emails."
26
- GEM_VERSION = "0.1"
27
+ GEM_VERSION = "0.2"
27
28
 
28
29
  spec = Gem::Specification.new do |s|
29
30
  s.name = NAME
30
31
  s.summary = s.description = SUMMARY
31
32
  s.author = "Bernerd Schaefer"
32
33
  s.email = "bernerd@wieck.com"
34
+ s.homepage = "http://wiecklabs.com"
33
35
  s.version = GEM_VERSION
34
36
  s.platform = Gem::Platform::RUBY
35
37
  s.require_path = 'lib'
@@ -28,7 +28,7 @@ class MailBuilder
28
28
  end
29
29
 
30
30
  def inspect
31
- "#<Wheels::Mail::Attachment @file=#{@file.inspect}> @name=#{@name.inspect} @type=#{@type.inspect} @headers=#{@headers.inspect}"
31
+ "#<MailBuilder::Attachment @file=#{@file.inspect}> @name=#{@name.inspect} @type=#{@type.inspect} @headers=#{@headers.inspect}"
32
32
  end
33
33
 
34
34
  end
data/lib/mail_builder.rb CHANGED
@@ -8,7 +8,6 @@ require 'rubygems'
8
8
  require 'mime/types'
9
9
 
10
10
  require 'rubygems'
11
- require 'mail_builder'
12
11
 
13
12
  ##
14
13
  # MailBuilder is a library for building RFC compliant MIME messages,
@@ -64,7 +63,7 @@ class MailBuilder
64
63
  ].freeze
65
64
 
66
65
  attr_accessor :html, :text
67
- attr_reader :headers
66
+ attr_reader :headers, :attachments
68
67
 
69
68
  ##
70
69
  # Accepts an options hash, setting text and html if provided, and
@@ -105,6 +104,7 @@ class MailBuilder
105
104
  def get_header(key)
106
105
  @headers.detect { |k, v| return v if k == key }
107
106
  end
107
+ alias [] get_header
108
108
 
109
109
  def remove_header(key)
110
110
  @headers.reject! { |k,| k == key }
@@ -122,11 +122,12 @@ class MailBuilder
122
122
  remove_header(key)
123
123
  add_header(key, value)
124
124
  end
125
+ alias []= set_header
125
126
 
126
127
  ##
127
128
  # Returns the envelope id for this mailer. The mail spec's ENV_ID is
128
129
  # used to provide a unique identifier that follows an email through it's
129
- # various states -- included bounces -- allowing it to be tracked.
130
+ # various states -- including bounces -- allowing it to be tracked.
130
131
  ##
131
132
  def envelope_id
132
133
  @envelope_id ||= (1..25).to_a.map { ENVELOPE_CHARS[rand(ENVELOPE_CHARS.size)] }.join
@@ -225,7 +226,7 @@ class MailBuilder
225
226
  end
226
227
 
227
228
  def build_body
228
- return @text unless multipart?
229
+ return @text.to_s unless multipart?
229
230
 
230
231
  body = []
231
232
  body << "This is a multi-part message in MIME format."
@@ -318,6 +319,6 @@ class MailBuilder
318
319
  end
319
320
 
320
321
  def rfc2045_encode(text)
321
- [text].pack('M').gsub("\n", "\r\n").chomp.gsub(/=$/, '')
322
+ [text].pack('M').gsub("\n", "\r\n").chomp("=\r\n")
322
323
  end
323
324
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: "0.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernerd Schaefer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-30 00:00:00 -05:00
12
+ date: 2009-11-22 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,11 +32,12 @@ extra_rdoc_files: []
32
32
 
33
33
  files:
34
34
  - Rakefile
35
- - lib/mail_builder
36
35
  - lib/mail_builder/attachment.rb
37
36
  - lib/mail_builder.rb
38
- has_rdoc: false
39
- homepage:
37
+ has_rdoc: true
38
+ homepage: http://wiecklabs.com
39
+ licenses: []
40
+
40
41
  post_install_message:
41
42
  rdoc_options: []
42
43
 
@@ -57,9 +58,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  requirements: []
58
59
 
59
60
  rubyforge_project:
60
- rubygems_version: 1.3.1
61
+ rubygems_version: 1.3.5
61
62
  signing_key:
62
- specification_version: 2
63
+ specification_version: 3
63
64
  summary: MailBuilder is a simple library for building RFC compliant MIME emails.
64
65
  test_files: []
65
66