doc/classes/Mack/Notifier/Adapters/Tmail.html in mack-notifier-0.7.0.1 vs doc/classes/Mack/Notifier/Adapters/Tmail.html in mack-notifier-0.7.1

- old
+ new

@@ -93,13 +93,13 @@ <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> - <a href="#M000025">convert</a>&nbsp;&nbsp; - <a href="#M000024">deliverable</a>&nbsp;&nbsp; - <a href="#M000023">transformed</a>&nbsp;&nbsp; + <a href="#M000031">convert</a>&nbsp;&nbsp; + <a href="#M000030">deliverable</a>&nbsp;&nbsp; + <a href="#M000029">transformed</a>&nbsp;&nbsp; </div> </div> </div> @@ -117,27 +117,27 @@ <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Instance methods</h3> - <div id="method-M000025" class="method-detail"> - <a name="M000025"></a> + <div id="method-M000031" class="method-detail"> + <a name="M000031"></a> <div class="method-heading"> - <a href="#M000025" class="method-signature"> + <a href="#M000031" class="method-signature"> <span class="method-name">convert</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Converts the <a href="../../Notifier.html">Mack::Notifier</a> object to a TMail object. </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000025-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000025-source"> + onclick="toggleCode('M000031-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000031-source"> <pre> <span class="ruby-comment cmt"># File lib/mack-notifier/adapters/tmail.rb, line 23</span> 23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span> 24: <span class="ruby-ivar">@tmail</span> = <span class="ruby-constant">TMail</span><span class="ruby-operator">::</span><span class="ruby-constant">Mail</span>.<span class="ruby-identifier">new</span> 25: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">to</span> = <span class="ruby-identifier">mack_notifier</span>.<span class="ruby-identifier">to</span> @@ -161,76 +161,85 @@ 43: <span class="ruby-identifier">html</span> = <span class="ruby-constant">TMail</span><span class="ruby-operator">::</span><span class="ruby-constant">Mail</span>.<span class="ruby-identifier">new</span> 44: <span class="ruby-identifier">html</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-value str">&quot;text/html&quot;</span> 45: <span class="ruby-identifier">html</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">mack_notifier</span>.<span class="ruby-identifier">body</span>(<span class="ruby-identifier">:html</span>) 46: <span class="ruby-identifier">main_body</span>.<span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">html</span> 47: <span class="ruby-keyword kw">end</span> -48: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">main_body</span>.<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">empty?</span> -49: <span class="ruby-identifier">main_body</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-value str">&quot;multipart/alternative&quot;</span> -50: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">main_body</span> -51: <span class="ruby-keyword kw">end</span> -52: -53: <span class="ruby-comment cmt"># set attachments, if any.</span> -54: <span class="ruby-identifier">mack_notifier</span>.<span class="ruby-identifier">attachments</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">at</span><span class="ruby-operator">|</span> -55: <span class="ruby-identifier">attachment</span> = <span class="ruby-constant">TMail</span><span class="ruby-operator">::</span><span class="ruby-constant">Mail</span>.<span class="ruby-identifier">new</span> -56: <span class="ruby-identifier">attachment</span>.<span class="ruby-identifier">body</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">at</span>.<span class="ruby-identifier">body</span>) -57: <span class="ruby-identifier">attachment</span>.<span class="ruby-identifier">transfer_encoding</span> = <span class="ruby-value str">&quot;Base64&quot;</span> -58: <span class="ruby-identifier">attachment</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-value str">&quot;application/octet-stream&quot;</span> -59: <span class="ruby-identifier">attachment</span>[<span class="ruby-value str">'Content-Disposition'</span>] = <span class="ruby-node">&quot;attachment; filename=#{at.file_name}&quot;</span> -60: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">attachment</span> -61: <span class="ruby-keyword kw">end</span> -62: -63: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">mack_notifier</span>.<span class="ruby-identifier">content_type</span> -64: <span class="ruby-keyword kw">end</span> +48: +49: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">main_body</span>.<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">empty?</span> +50: <span class="ruby-identifier">main_body</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-value str">&quot;multipart/alternative&quot;</span> +51: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mack_notifier</span>.<span class="ruby-identifier">attachments</span>.<span class="ruby-identifier">any?</span> <span class="ruby-comment cmt"># there's an attachment</span> +52: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">main_body</span> +53: <span class="ruby-keyword kw">else</span> +54: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">main_body</span>.<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> +55: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">main_body</span>.<span class="ruby-identifier">parts</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">body</span> +56: <span class="ruby-keyword kw">else</span> +57: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">main_body</span> +58: <span class="ruby-keyword kw">end</span> +59: <span class="ruby-keyword kw">end</span> +60: <span class="ruby-keyword kw">end</span> +61: +62: <span class="ruby-comment cmt"># set attachments, if any.</span> +63: <span class="ruby-identifier">mack_notifier</span>.<span class="ruby-identifier">attachments</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">at</span><span class="ruby-operator">|</span> +64: <span class="ruby-identifier">attachment</span> = <span class="ruby-constant">TMail</span><span class="ruby-operator">::</span><span class="ruby-constant">Mail</span>.<span class="ruby-identifier">new</span> +65: <span class="ruby-identifier">attachment</span>.<span class="ruby-identifier">body</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">at</span>.<span class="ruby-identifier">body</span>) +66: <span class="ruby-identifier">attachment</span>.<span class="ruby-identifier">transfer_encoding</span> = <span class="ruby-value str">&quot;Base64&quot;</span> +67: <span class="ruby-identifier">attachment</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-value str">&quot;application/octet-stream&quot;</span> +68: <span class="ruby-identifier">attachment</span>[<span class="ruby-value str">'Content-Disposition'</span>] = <span class="ruby-node">&quot;attachment; filename=#{at.file_name}&quot;</span> +69: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">attachment</span> +70: <span class="ruby-keyword kw">end</span> +71: +72: <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">mack_notifier</span>.<span class="ruby-identifier">content_type</span> +73: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000024" class="method-detail"> - <a name="M000024"></a> + <div id="method-M000030" class="method-detail"> + <a name="M000030"></a> <div class="method-heading"> - <a href="#M000024" class="method-signature"> + <a href="#M000030" class="method-signature"> <span class="method-name">deliverable</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns the ready to be delivered encoded String </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000024-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000024-source"> + onclick="toggleCode('M000030-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000030-source"> <pre> <span class="ruby-comment cmt"># File lib/mack-notifier/adapters/tmail.rb, line 18</span> 18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">deliverable</span> 19: <span class="ruby-identifier">transformed</span>.<span class="ruby-identifier">encoded</span> 20: <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> - <div id="method-M000023" class="method-detail"> - <a name="M000023"></a> + <div id="method-M000029" class="method-detail"> + <a name="M000029"></a> <div class="method-heading"> - <a href="#M000023" class="method-signature"> + <a href="#M000029" class="method-signature"> <span class="method-name">transformed</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns the underlying TMail object. Raises <a href="../../Errors/UnconvertedNotifier.html">Mack::Errors::UnconvertedNotifier</a> -if the <a href="Tmail.html#M000025">convert</a> method hasn&#8216;t been +if the <a href="Tmail.html#M000031">convert</a> method hasn&#8216;t been called first. </p> <p><a class="source-toggle" href="#" - onclick="toggleCode('M000023-source');return false;">[Source]</a></p> - <div class="method-source-code" id="M000023-source"> + onclick="toggleCode('M000029-source');return false;">[Source]</a></p> + <div class="method-source-code" id="M000029-source"> <pre> <span class="ruby-comment cmt"># File lib/mack-notifier/adapters/tmail.rb, line 12</span> 12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">transformed</span> 13: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">UnconvertedNotifier</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@tmail</span>.<span class="ruby-identifier">nil?</span> 14: <span class="ruby-ivar">@tmail</span> \ No newline at end of file