doc/lib/fozzie/socket.html in fozzie-0.0.17 vs doc/lib/fozzie/socket.html in fozzie-0.0.18
- old
+ new
@@ -37,11 +37,13 @@
<a class="pilcrow" href="#section-1">¶</a>
</div>
</td>
<td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Fozzie</span>
+ <div class='highlight'><pre><span class="nb">require</span> <span class="s1">'socket'</span>
+
+<span class="k">module</span> <span class="nn">Fozzie</span>
<span class="k">module</span> <span class="nn">Socket</span>
<span class="no">RESERVED_CHARS_REGEX</span> <span class="o">=</span> <span class="sr">/[\:\|\@]/</span>
<span class="kp">private</span></pre></div>
@@ -55,17 +57,17 @@
<p>Send the statistic to the server</p>
<p>Creates the Statsd key from the given values, and sends to socket (depending on sample rate)</p>
</td>
<td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">send</span><span class="p">(</span><span class="n">stat</span><span class="p">,</span> <span class="n">delta</span><span class="p">,</span> <span class="nb">type</span><span class="p">,</span> <span class="n">sample_rate</span><span class="p">)</span>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">send</span><span class="p">(</span><span class="n">stat</span><span class="p">,</span> <span class="n">delta</span><span class="p">,</span> <span class="n">type</span><span class="p">,</span> <span class="n">sample_rate</span><span class="p">)</span>
<span class="n">stat</span> <span class="o">=</span> <span class="o">[</span><span class="n">stat</span><span class="o">].</span><span class="n">flatten</span><span class="o">.</span><span class="n">compact</span><span class="o">.</span><span class="n">collect</span><span class="p">(</span><span class="o">&</span><span class="ss">:to_s</span><span class="p">)</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s1">'.'</span><span class="p">)</span><span class="o">.</span><span class="n">downcase</span>
<span class="n">stat</span> <span class="o">=</span> <span class="n">stat</span><span class="o">.</span><span class="n">gsub</span><span class="p">(</span><span class="s1">'::'</span><span class="p">,</span> <span class="s1">'.'</span><span class="p">)</span><span class="o">.</span><span class="n">gsub</span><span class="p">(</span><span class="no">RESERVED_CHARS_REGEX</span><span class="p">,</span> <span class="s1">'_'</span><span class="p">)</span>
<span class="n">k</span> <span class="o">=</span> <span class="o">[</span><span class="no">Fozzie</span><span class="o">.</span><span class="n">c</span><span class="o">.</span><span class="n">data_prefix</span><span class="p">,</span> <span class="n">stat</span><span class="o">].</span><span class="n">compact</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s1">'.'</span><span class="p">)</span>
<span class="n">k</span> <span class="o"><<</span> <span class="s2">":"</span>
- <span class="n">k</span> <span class="o"><<</span> <span class="o">[</span><span class="n">delta</span><span class="p">,</span> <span class="nb">type</span><span class="o">].</span><span class="n">join</span><span class="p">(</span><span class="s1">'|'</span><span class="p">)</span>
+ <span class="n">k</span> <span class="o"><<</span> <span class="o">[</span><span class="n">delta</span><span class="p">,</span> <span class="n">type</span><span class="o">].</span><span class="n">join</span><span class="p">(</span><span class="s1">'|'</span><span class="p">)</span>
<span class="n">k</span> <span class="o"><<</span> <span class="s1">'@%s'</span> <span class="o">%</span> <span class="n">sample_rate</span><span class="o">.</span><span class="n">to_s</span> <span class="k">if</span> <span class="n">sample_rate</span> <span class="o"><</span> <span class="mi">1</span>
<span class="n">sampled</span><span class="p">(</span><span class="n">sample_rate</span><span class="p">)</span> <span class="p">{</span> <span class="n">send_to_socket</span><span class="p">(</span><span class="n">k</span><span class="o">.</span><span class="n">strip</span><span class="p">)</span> <span class="p">}</span>
<span class="k">end</span></pre></div>
</td>
@@ -113,10 +115,10 @@
<p>The Socket we want to use to send data</p>
</td>
<td class=code>
<div class='highlight'><pre> <span class="k">def</span> <span class="nf">socket</span>
- <span class="vi">@socket</span> <span class="o">||=</span> <span class="no">UDPSocket</span><span class="o">.</span><span class="n">new</span>
+ <span class="vi">@socket</span> <span class="o">||=</span> <span class="o">::</span><span class="no">UDPSocket</span><span class="o">.</span><span class="n">new</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span></pre></div>
</td>