easy_multipart 0.1.0 → 0.1.1
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/easy_multipart/version.rb +2 -2
- metadata +3 -23
- data/lib/rdoc/classes/EasyMultipart/Base.html +0 -163
- data/lib/rdoc/classes/EasyMultipart/Base.src/M000001.html +0 -26
- data/lib/rdoc/classes/EasyMultipart/Base.src/M000002.html +0 -26
- data/lib/rdoc/classes/EasyMultipart/Base.src/M000003.html +0 -22
- data/lib/rdoc/classes/EasyMultipart/Base.src/M000004.html +0 -40
- data/lib/rdoc/classes/EasyMultipart/Base.src/M000005.html +0 -22
- data/lib/rdoc/classes/EasyMultipart/Base.src/M000006.html +0 -18
- data/lib/rdoc/classes/EasyMultipart/Helper.html +0 -177
- data/lib/rdoc/classes/EasyMultipart/Helper.src/M000001.html +0 -45
- data/lib/rdoc/classes/EasyMultipart/Helper.src/M000007.html +0 -45
- data/lib/rdoc/created.rid +0 -1
- data/lib/rdoc/files/easy_multipart/base_rb.html +0 -108
- data/lib/rdoc/files/easy_multipart/helper_rb.html +0 -101
- data/lib/rdoc/files/easy_multipart/version_rb.html +0 -101
- data/lib/rdoc/files/easy_multipart_rb.html +0 -108
- data/lib/rdoc/fr_class_index.html +0 -27
- data/lib/rdoc/fr_file_index.html +0 -27
- data/lib/rdoc/fr_method_index.html +0 -27
- data/lib/rdoc/index.html +0 -24
- data/lib/rdoc/rdoc-style.css +0 -208
@@ -1,3 +1,3 @@
|
|
1
1
|
module EasyMultipart
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
2
|
+
VERSION = "0.1.1"
|
3
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_multipart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrea Campi
|
@@ -33,26 +33,6 @@ files:
|
|
33
33
|
- lib/easy_multipart/helper.rb
|
34
34
|
- lib/easy_multipart/version.rb
|
35
35
|
- lib/easy_multipart.rb
|
36
|
-
- lib/rdoc/classes/EasyMultipart/Base.html
|
37
|
-
- lib/rdoc/classes/EasyMultipart/Base.src/M000001.html
|
38
|
-
- lib/rdoc/classes/EasyMultipart/Base.src/M000002.html
|
39
|
-
- lib/rdoc/classes/EasyMultipart/Base.src/M000003.html
|
40
|
-
- lib/rdoc/classes/EasyMultipart/Base.src/M000004.html
|
41
|
-
- lib/rdoc/classes/EasyMultipart/Base.src/M000005.html
|
42
|
-
- lib/rdoc/classes/EasyMultipart/Base.src/M000006.html
|
43
|
-
- lib/rdoc/classes/EasyMultipart/Helper.html
|
44
|
-
- lib/rdoc/classes/EasyMultipart/Helper.src/M000001.html
|
45
|
-
- lib/rdoc/classes/EasyMultipart/Helper.src/M000007.html
|
46
|
-
- lib/rdoc/created.rid
|
47
|
-
- lib/rdoc/files/easy_multipart/base_rb.html
|
48
|
-
- lib/rdoc/files/easy_multipart/helper_rb.html
|
49
|
-
- lib/rdoc/files/easy_multipart/version_rb.html
|
50
|
-
- lib/rdoc/files/easy_multipart_rb.html
|
51
|
-
- lib/rdoc/fr_class_index.html
|
52
|
-
- lib/rdoc/fr_file_index.html
|
53
|
-
- lib/rdoc/fr_method_index.html
|
54
|
-
- lib/rdoc/index.html
|
55
|
-
- lib/rdoc/rdoc-style.css
|
56
36
|
- LICENSE
|
57
37
|
- README.md
|
58
38
|
has_rdoc: true
|
@@ -1,163 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Module: EasyMultipart::Base</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">EasyMultipart::Base</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/easy_multipart/base_rb.html">
|
59
|
-
easy_multipart/base.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
<div id="description">
|
76
|
-
<p>
|
77
|
-
This module enables EasyMultipart functionality for the mailers it is
|
78
|
-
included in.
|
79
|
-
</p>
|
80
|
-
<h4>Examples</h4>
|
81
|
-
<p>
|
82
|
-
Import easy_mailer in one mailer:
|
83
|
-
</p>
|
84
|
-
<pre>
|
85
|
-
class MyMailer
|
86
|
-
import EasyMultipart::Base
|
87
|
-
end
|
88
|
-
</pre>
|
89
|
-
<p>
|
90
|
-
Import easy_mailer in all the mailers of a Rails application:
|
91
|
-
</p>
|
92
|
-
<pre>
|
93
|
-
ActiveMailer::Base.extend EasyMultipart::Base
|
94
|
-
</pre>
|
95
|
-
|
96
|
-
</div>
|
97
|
-
|
98
|
-
|
99
|
-
</div>
|
100
|
-
|
101
|
-
<div id="method-list">
|
102
|
-
<h3 class="section-bar">Methods</h3>
|
103
|
-
|
104
|
-
<div class="name-list">
|
105
|
-
<a href="#M000001">easy_multipart</a>
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
|
109
|
-
</div>
|
110
|
-
|
111
|
-
|
112
|
-
<!-- if includes -->
|
113
|
-
|
114
|
-
<div id="section">
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
<!-- if method_list -->
|
124
|
-
<div id="methods">
|
125
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
126
|
-
|
127
|
-
<div id="method-M000001" class="method-detail">
|
128
|
-
<a name="M000001"></a>
|
129
|
-
|
130
|
-
<div class="method-heading">
|
131
|
-
<a href="Base.src/M000001.html" target="Code" class="method-signature"
|
132
|
-
onclick="popupCode('Base.src/M000001.html');return false;">
|
133
|
-
<span class="method-name">easy_multipart</span><span class="method-args">(options = {}, &block)</span>
|
134
|
-
</a>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
<div class="method-description">
|
138
|
-
<p>
|
139
|
-
Prepares the content of a multipart email. You can pass a <tt>options</tt>
|
140
|
-
hash with one key:
|
141
|
-
</p>
|
142
|
-
<ul>
|
143
|
-
<li><tt>body</tt> - a hash which generates an instance variable named after
|
144
|
-
each key in the hash containing the value that that key points to.
|
145
|
-
|
146
|
-
</li>
|
147
|
-
</ul>
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
|
151
|
-
|
152
|
-
</div>
|
153
|
-
|
154
|
-
|
155
|
-
</div>
|
156
|
-
|
157
|
-
|
158
|
-
<div id="validator-badges">
|
159
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
160
|
-
</div>
|
161
|
-
|
162
|
-
</body>
|
163
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>easy_multipart (EasyMultipart::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File easy_multipart/base.rb, line 30</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">easy_multipart</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
-
<span class="ruby-identifier">content_type</span> <span class="ruby-value str">'multipart/alternative'</span>
|
16
|
-
<span class="ruby-constant">TMail</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderField</span><span class="ruby-operator">::</span><span class="ruby-constant">FNAME_TO_CLASS</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">'content-id'</span>
|
17
|
-
|
18
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">:body</span>)
|
19
|
-
<span class="ruby-identifier">body</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:body</span>)
|
20
|
-
<span class="ruby-keyword kw">end</span>
|
21
|
-
|
22
|
-
<span class="ruby-identifier">add_plain_part</span>
|
23
|
-
<span class="ruby-identifier">add_html_part</span>
|
24
|
-
<span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>easy_multipart (EasyMultipart::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File easy_multipart/base.rb, line 25</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">easy_multipart</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
-
<span class="ruby-identifier">content_type</span> <span class="ruby-value str">'multipart/alternative'</span>
|
16
|
-
<span class="ruby-constant">TMail</span><span class="ruby-operator">::</span><span class="ruby-constant">HeaderField</span><span class="ruby-operator">::</span><span class="ruby-constant">FNAME_TO_CLASS</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">'content-id'</span>
|
17
|
-
|
18
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">:body</span>)
|
19
|
-
<span class="ruby-identifier">body</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:body</span>)
|
20
|
-
<span class="ruby-keyword kw">end</span>
|
21
|
-
|
22
|
-
<span class="ruby-identifier">add_plain_part</span>
|
23
|
-
<span class="ruby-identifier">add_html_part</span>
|
24
|
-
<span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>add_plain_part (EasyMultipart::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File easy_multipart/base.rb, line 37</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_plain_part</span>
|
15
|
-
<span class="ruby-identifier">template</span> = <span class="ruby-identifier">find_template_for</span>(<span class="ruby-value str">"text.plain"</span>)
|
16
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">template</span>
|
17
|
-
|
18
|
-
<span class="ruby-identifier">part</span> <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"text/plain"</span>,
|
19
|
-
<span class="ruby-identifier">:body</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">render_message</span>(<span class="ruby-identifier">template</span>, <span class="ruby-ivar">@body</span>)
|
20
|
-
<span class="ruby-keyword kw">end</span></pre>
|
21
|
-
</body>
|
22
|
-
</html>
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>add_html_part (EasyMultipart::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File easy_multipart/base.rb, line 45</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_html_part</span>
|
15
|
-
<span class="ruby-identifier">template</span> = <span class="ruby-identifier">find_template_for</span>(<span class="ruby-value str">"text.html"</span>)
|
16
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">template</span>
|
17
|
-
|
18
|
-
<span class="ruby-ivar">@related</span> = {}
|
19
|
-
<span class="ruby-identifier">body</span> = <span class="ruby-identifier">render_message</span>(<span class="ruby-identifier">template</span>, <span class="ruby-ivar">@body</span>)
|
20
|
-
|
21
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@related</span>.<span class="ruby-identifier">empty?</span>
|
22
|
-
<span class="ruby-identifier">part</span> <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"text/html"</span>,
|
23
|
-
<span class="ruby-identifier">:body</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">body</span>
|
24
|
-
<span class="ruby-keyword kw">return</span>
|
25
|
-
<span class="ruby-keyword kw">end</span>
|
26
|
-
|
27
|
-
<span class="ruby-identifier">part</span> <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'multipart/related'</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">related</span><span class="ruby-operator">|</span>
|
28
|
-
<span class="ruby-identifier">related</span>.<span class="ruby-identifier">part</span> <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"text/html"</span>,
|
29
|
-
<span class="ruby-identifier">:body</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">body</span>
|
30
|
-
|
31
|
-
<span class="ruby-ivar">@related</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">content_id</span>, <span class="ruby-identifier">img</span><span class="ruby-operator">|</span>
|
32
|
-
<span class="ruby-identifier">related</span>.<span class="ruby-identifier">part</span>(<span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">img</span>[<span class="ruby-value">0</span>],
|
33
|
-
<span class="ruby-identifier">:headers</span> =<span class="ruby-operator">></span> {<span class="ruby-value str">'Content-ID'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">format_content_id</span>(<span class="ruby-identifier">content_id</span>)}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">image</span><span class="ruby-operator">|</span>
|
34
|
-
<span class="ruby-identifier">img</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">image</span>)
|
35
|
-
<span class="ruby-keyword kw">end</span>
|
36
|
-
<span class="ruby-keyword kw">end</span>
|
37
|
-
<span class="ruby-keyword kw">end</span>
|
38
|
-
<span class="ruby-keyword kw">end</span></pre>
|
39
|
-
</body>
|
40
|
-
</html>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>find_template_for (EasyMultipart::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File easy_multipart/base.rb, line 71</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_template_for</span>(<span class="ruby-identifier">format</span>)
|
15
|
-
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-node">"#{template_path}/#{@template}.*"</span>).<span class="ruby-identifier">select</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
|
16
|
-
<span class="ruby-identifier">template</span> = <span class="ruby-identifier">template_root</span>[<span class="ruby-node">"#{mailer_name}/#{File.basename(path)}"</span>]
|
17
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">template</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">template</span>.<span class="ruby-identifier">format</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">format</span>
|
18
|
-
<span class="ruby-keyword kw">end</span>
|
19
|
-
<span class="ruby-keyword kw">nil</span>
|
20
|
-
<span class="ruby-keyword kw">end</span></pre>
|
21
|
-
</body>
|
22
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>format_content_id (EasyMultipart::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File easy_multipart/base.rb, line 80</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">format_content_id</span>(<span class="ruby-identifier">content_id</span>)
|
15
|
-
<span class="ruby-node">"<#{content_id}>"</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,177 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Module: EasyMultipart::Helper</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">EasyMultipart::Helper</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/easy_multipart/helper_rb.html">
|
59
|
-
easy_multipart/helper.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
<div id="description">
|
76
|
-
<p>
|
77
|
-
This module provides methods for generating HTML body parts that include
|
78
|
-
embedded images.
|
79
|
-
</p>
|
80
|
-
|
81
|
-
</div>
|
82
|
-
|
83
|
-
|
84
|
-
</div>
|
85
|
-
|
86
|
-
<div id="method-list">
|
87
|
-
<h3 class="section-bar">Methods</h3>
|
88
|
-
|
89
|
-
<div class="name-list">
|
90
|
-
<a href="#M000001">related_image_tag</a>
|
91
|
-
</div>
|
92
|
-
</div>
|
93
|
-
|
94
|
-
</div>
|
95
|
-
|
96
|
-
|
97
|
-
<!-- if includes -->
|
98
|
-
|
99
|
-
<div id="section">
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<!-- if method_list -->
|
109
|
-
<div id="methods">
|
110
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
111
|
-
|
112
|
-
<div id="method-M000001" class="method-detail">
|
113
|
-
<a name="M000001"></a>
|
114
|
-
|
115
|
-
<div class="method-heading">
|
116
|
-
<a href="Helper.src/M000001.html" target="Code" class="method-signature"
|
117
|
-
onclick="popupCode('Helper.src/M000001.html');return false;">
|
118
|
-
<span class="method-name">related_image_tag</span><span class="method-args">(source, image_options = {}, related_options = {})</span>
|
119
|
-
</a>
|
120
|
-
</div>
|
121
|
-
|
122
|
-
<div class="method-description">
|
123
|
-
<p>
|
124
|
-
Returns an HTML image tag for the <tt>source</tt>. The <tt>source</tt> can
|
125
|
-
be a full path or a file that exists in your public images directory.
|
126
|
-
Alternatively, it can be a hash with these mandatory keys:
|
127
|
-
</p>
|
128
|
-
<ul>
|
129
|
-
<li><tt>:body</tt> - An object representing the image content. Any kind of
|
130
|
-
object can be used, as long as it responds to :to_s.
|
131
|
-
|
132
|
-
</li>
|
133
|
-
<li><tt>:content_id</tt> - A string that uniquely identifies the image within
|
134
|
-
the current document.
|
135
|
-
|
136
|
-
</li>
|
137
|
-
</ul>
|
138
|
-
<h4>Options</h4>
|
139
|
-
<p>
|
140
|
-
You can add HTML attributes using the <tt>image_options</tt>. You can pass
|
141
|
-
any option accepted by <tt>image_tag</tt>.
|
142
|
-
</p>
|
143
|
-
<p>
|
144
|
-
You can pass additional options through <tt>related_options</tt>:
|
145
|
-
</p>
|
146
|
-
<ul>
|
147
|
-
<li><tt>:content_type</tt> - The value to use for the Content-Type MIME header.
|
148
|
-
If not provided it defaults to ‘image/png’.
|
149
|
-
|
150
|
-
</li>
|
151
|
-
<li><tt>:transfer_encoding</tt> - The value to use for the Transfer-Encoding
|
152
|
-
MIME header. If not provided it defaults to ‘base64’. Unless
|
153
|
-
you have special requirements, you should not provide a value for this key.
|
154
|
-
|
155
|
-
</li>
|
156
|
-
<li><tt>:content_disposition</tt> - The value to use for the
|
157
|
-
Content-Disposition MIME header. If not provided it defaults to not
|
158
|
-
generating a Content-Disposition header.
|
159
|
-
|
160
|
-
</li>
|
161
|
-
</ul>
|
162
|
-
</div>
|
163
|
-
</div>
|
164
|
-
|
165
|
-
|
166
|
-
</div>
|
167
|
-
|
168
|
-
|
169
|
-
</div>
|
170
|
-
|
171
|
-
|
172
|
-
<div id="validator-badges">
|
173
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
</body>
|
177
|
-
</html>
|
@@ -1,45 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>related_image_tag (EasyMultipart::Helper)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File easy_multipart/helper.rb, line 29</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">related_image_tag</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">image_options</span> = {}, <span class="ruby-identifier">related_options</span> = {})
|
15
|
-
<span class="ruby-identifier">related_options</span>.<span class="ruby-identifier">reverse_merge!</span> <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'image/png'</span>,
|
16
|
-
<span class="ruby-identifier">:transfer_encoding</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'base64'</span>
|
17
|
-
|
18
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
19
|
-
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">:content_id</span>)
|
20
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"You must specify a :content_id if you provide a :body"</span>
|
21
|
-
<span class="ruby-keyword kw">end</span>
|
22
|
-
|
23
|
-
<span class="ruby-identifier">content_id</span> = <span class="ruby-identifier">source</span>[<span class="ruby-identifier">:content_id</span>]
|
24
|
-
<span class="ruby-identifier">source</span> = <span class="ruby-identifier">source</span>[<span class="ruby-identifier">:body</span>].<span class="ruby-identifier">to_s</span>
|
25
|
-
<span class="ruby-keyword kw">else</span>
|
26
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'/'</span>
|
27
|
-
<span class="ruby-identifier">assets_dir</span> = <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rails</span>.<span class="ruby-identifier">public_path</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">public_path</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"public"</span>
|
28
|
-
<span class="ruby-identifier">source</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">assets_dir</span>, <span class="ruby-value str">"images"</span>, <span class="ruby-identifier">source</span>)
|
29
|
-
<span class="ruby-keyword kw">end</span>
|
30
|
-
|
31
|
-
<span class="ruby-identifier">content_id</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">source</span>)
|
32
|
-
<span class="ruby-identifier">source</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">source</span>)
|
33
|
-
<span class="ruby-keyword kw">end</span>
|
34
|
-
<span class="ruby-identifier">content_id</span> = <span class="ruby-identifier">normalize_content_id</span>(<span class="ruby-identifier">content_id</span>)
|
35
|
-
|
36
|
-
<span class="ruby-ivar">@related</span>[<span class="ruby-identifier">content_id</span>] = [<span class="ruby-identifier">related_options</span>[<span class="ruby-identifier">:content_type</span>], <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">image</span><span class="ruby-operator">|</span>
|
37
|
-
<span class="ruby-identifier">image</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">source</span>
|
38
|
-
<span class="ruby-identifier">image</span>.<span class="ruby-identifier">transfer_encoding</span> = <span class="ruby-identifier">related_options</span>[<span class="ruby-identifier">:transfer_encoding</span>]
|
39
|
-
<span class="ruby-identifier">image</span>.<span class="ruby-identifier">content_disposition</span> = <span class="ruby-identifier">related_options</span>[<span class="ruby-identifier">:content_disposition</span>] <span class="ruby-comment cmt"># default is none</span>
|
40
|
-
<span class="ruby-keyword kw">end</span>]
|
41
|
-
|
42
|
-
<span class="ruby-ivar">@template</span>.<span class="ruby-identifier">tag</span>(<span class="ruby-identifier">:img</span>, <span class="ruby-identifier">image_options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:src</span> =<span class="ruby-operator">></span> <span class="ruby-node">"cid:#{content_id}"</span>))
|
43
|
-
<span class="ruby-keyword kw">end</span></pre>
|
44
|
-
</body>
|
45
|
-
</html>
|