doc/Trackerific.html in trackerific-0.3.2 vs doc/Trackerific.html in trackerific-0.3.3
- old
+ new
@@ -71,20 +71,20 @@
<dt class="r1 last">Defined in:</dt>
<dd class="r1 last">lib/trackerific.rb<span class="defines">,<br />
- lib/ups.rb,<br /> lib/usps.rb,<br /> lib/fedex.rb,<br /> lib/trackerific_event.rb,<br /> lib/trackerific_details.rb</span>
+ lib/trackerific/base.rb,<br /> lib/trackerific/event.rb,<br /> lib/trackerific/error.rb,<br /> lib/trackerific/details.rb,<br /> lib/trackerific/services/ups.rb,<br /> lib/trackerific/services/usps.rb,<br /> lib/trackerific/services/fedex.rb</span>
</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>
-Trackerific is a UPS, FedEx and USPS tracking provider.
+Trackerific provides package tracking to Rails apps.
</p>
</div>
</div>
@@ -221,35 +221,47 @@
<tr>
<td>
<pre class="lines">
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87</pre>
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/trackerific.rb', line 77</span>
+ <pre class="code"><span class="info file"># File 'lib/trackerific.rb', line 21</span>
<span class='kw'>def</span> <span class='id tracking_service'>tracking_service</span><span class='lparen'>(</span><span class='id package_id'>package_id</span><span class='rparen'>)</span>
- <span class='kw'>case</span> <span class='id package_id'>package_id</span>
- <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^.Z</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[HK].{10}$</span><span class='regexp_end'>/</span></span> <span class='kw'>then</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>UPS</span>
- <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^96.{20}$</span><span class='regexp_end'>/</span></span> <span class='kw'>then</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>FedEx</span>
- <span class='kw'>else</span> <span class='kw'>case</span> <span class='id package_id'>package_id</span><span class='period'>.</span><span class='id length'>length</span>
- <span class='kw'>when</span> <span class='int'>13</span><span class='comma'>,</span> <span class='int'>20</span><span class='comma'>,</span> <span class='int'>22</span><span class='comma'>,</span> <span class='int'>30</span> <span class='kw'>then</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>USPS</span>
- <span class='kw'>when</span> <span class='int'>12</span><span class='comma'>,</span> <span class='int'>15</span><span class='comma'>,</span> <span class='int'>19</span> <span class='kw'>then</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>FedEx</span>
- <span class='kw'>else</span> <span class='kw'>nil</span>
+ <span class='comment'># loop through each constant in Trackerific
+</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id constants'>constants</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id const'>const</span><span class='op'>|</span>
+ <span class='comment'># get the constant's class
+</span> <span class='id cls'>cls</span> <span class='op'>=</span> <span class='const'>Trackerific</span><span class='period'>.</span><span class='id const_get'>const_get</span><span class='lparen'>(</span><span class='id const'>const</span><span class='rparen'>)</span>
+ <span class='comment'># check if it descends from Trackerific::Base
+</span> <span class='kw'>if</span> <span class='id cls'>cls</span><span class='period'>.</span><span class='id superclass'>superclass</span> <span class='op'>==</span> <span class='const'>Trackerific</span><span class='op'>::</span><span class='const'>Base</span>
+ <span class='comment'># loop through each package id matcher
+</span> <span class='id cls'>cls</span><span class='period'>.</span><span class='id package_id_matchers'>package_id_matchers</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id matcher'>matcher</span><span class='op'>|</span>
+ <span class='comment'># return the class if it matches
+</span> <span class='kw'>return</span> <span class='id cls'>cls</span> <span class='kw'>if</span> <span class='id package_id'>package_id</span> <span class='op'>=~</span> <span class='id matcher'>matcher</span>
+ <span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
+ <span class='comment'># if we've made it this far, nothing matched
+</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
@@ -257,10 +269,10 @@
</div>
</div>
<div id="footer">
- Generated on Mon Jun 13 16:20:05 2011 by
+ Generated on Mon Jun 13 21:28:36 2011 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.7.1 (ruby-1.9.2).
</div>
</body>
\ No newline at end of file