actionmailer 3.0.4 → 3.0.5.rc1
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/lib/action_mailer/mail_helper.rb +18 -10
- data/lib/action_mailer/version.rb +2 -2
- metadata +19 -13
|
@@ -3,17 +3,8 @@ module ActionMailer
|
|
|
3
3
|
# Uses Text::Format to take the text and format it, indented two spaces for
|
|
4
4
|
# each line, and wrapped at 72 columns.
|
|
5
5
|
def block_format(text)
|
|
6
|
-
begin
|
|
7
|
-
require 'text/format'
|
|
8
|
-
rescue LoadError => e
|
|
9
|
-
$stderr.puts "You don't have text-format installed in your application. Please add it to your Gemfile and run bundle install"
|
|
10
|
-
raise e
|
|
11
|
-
end unless defined?(Text::Format)
|
|
12
|
-
|
|
13
6
|
formatted = text.split(/\n\r\n/).collect { |paragraph|
|
|
14
|
-
|
|
15
|
-
:columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
|
|
16
|
-
).format
|
|
7
|
+
simple_format(paragraph)
|
|
17
8
|
}.join("\n")
|
|
18
9
|
|
|
19
10
|
# Make list points stand on their own line
|
|
@@ -37,5 +28,22 @@ module ActionMailer
|
|
|
37
28
|
def attachments
|
|
38
29
|
@_message.attachments
|
|
39
30
|
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
def simple_format(text, len = 72, indent = 2)
|
|
34
|
+
sentences = [[]]
|
|
35
|
+
|
|
36
|
+
text.split.each do |word|
|
|
37
|
+
if (sentences.last + [word]).join(' ').length > len
|
|
38
|
+
sentences << [word]
|
|
39
|
+
else
|
|
40
|
+
sentences.last << word
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
sentences.map { |sentence|
|
|
45
|
+
"#{" " * indent}#{sentence.join(' ')}"
|
|
46
|
+
}.join "\n"
|
|
47
|
+
end
|
|
40
48
|
end
|
|
41
49
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: actionmailer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 15424095
|
|
5
|
+
prerelease: 6
|
|
6
6
|
segments:
|
|
7
7
|
- 3
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
|
|
9
|
+
- 5
|
|
10
|
+
- rc
|
|
11
|
+
- 1
|
|
12
|
+
version: 3.0.5.rc1
|
|
11
13
|
platform: ruby
|
|
12
14
|
authors:
|
|
13
15
|
- David Heinemeier Hansson
|
|
@@ -15,7 +17,7 @@ autorequire:
|
|
|
15
17
|
bindir: bin
|
|
16
18
|
cert_chain: []
|
|
17
19
|
|
|
18
|
-
date: 2011-02-
|
|
20
|
+
date: 2011-02-22 00:00:00 -08:00
|
|
19
21
|
default_executable:
|
|
20
22
|
dependencies:
|
|
21
23
|
- !ruby/object:Gem::Dependency
|
|
@@ -26,12 +28,14 @@ dependencies:
|
|
|
26
28
|
requirements:
|
|
27
29
|
- - "="
|
|
28
30
|
- !ruby/object:Gem::Version
|
|
29
|
-
hash:
|
|
31
|
+
hash: 15424095
|
|
30
32
|
segments:
|
|
31
33
|
- 3
|
|
32
34
|
- 0
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
+
- 5
|
|
36
|
+
- rc
|
|
37
|
+
- 1
|
|
38
|
+
version: 3.0.5.rc1
|
|
35
39
|
type: :runtime
|
|
36
40
|
version_requirements: *id001
|
|
37
41
|
- !ruby/object:Gem::Dependency
|
|
@@ -102,16 +106,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
102
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
107
|
none: false
|
|
104
108
|
requirements:
|
|
105
|
-
- - "
|
|
109
|
+
- - ">"
|
|
106
110
|
- !ruby/object:Gem::Version
|
|
107
|
-
hash:
|
|
111
|
+
hash: 25
|
|
108
112
|
segments:
|
|
109
|
-
-
|
|
110
|
-
|
|
113
|
+
- 1
|
|
114
|
+
- 3
|
|
115
|
+
- 1
|
|
116
|
+
version: 1.3.1
|
|
111
117
|
requirements:
|
|
112
118
|
- none
|
|
113
119
|
rubyforge_project: actionmailer
|
|
114
|
-
rubygems_version: 1.
|
|
120
|
+
rubygems_version: 1.5.2
|
|
115
121
|
signing_key:
|
|
116
122
|
specification_version: 3
|
|
117
123
|
summary: Email composition, delivery, and receiving framework (part of Rails).
|