coverage/index.html in redis_analytics-0.7.1 vs coverage/index.html in redis_analytics-1.0.0

- old
+ new

@@ -12,31 +12,31 @@ <body> <div id="loading"> <img src="./assets/0.8.0/loading.gif" alt="loading"/> </div> <div id="wrapper" style="display:none;"> - <div class="timestamp">Generated <abbr class="timeago" title="2014-04-21T16:50:00+05:30">2014-04-21T16:50:00+05:30</abbr></div> + <div class="timestamp">Generated <abbr class="timeago" title="2014-05-17T00:31:13+05:30">2014-05-17T00:31:13+05:30</abbr></div> <ul class="group_tabs"></ul> <div id="content"> <div class="file_list_container" id="AllFiles"> <h2> <span class="group_name">All Files</span> - (<span class="covered_percent"><span class="red">78.87%</span></span> + (<span class="covered_percent"><span class="red">78.67%</span></span> covered at <span class="covered_strength"> <span class="green"> - 7.11 + 7.07 </span> </span> hits/line) </h2> <a name="AllFiles"></a> <div> <b>10</b> files in total. - <b>284</b> relevant lines. - <span class="green"><b>224</b> lines covered</span> and - <span class="red"><b>60</b> lines missed </span> + <b>286</b> relevant lines. + <span class="green"><b>225</b> lines covered</span> and + <span class="red"><b>61</b> lines missed </span> </div> <table class="file_list"> <thead> <tr> <th>File</th> @@ -70,15 +70,15 @@ <td>3.7</td> </tr> <tr> <td class="strong"><a href="#092dae03526444499262440a90b632344ec5532e" class="src_link" title="lib/redis_analytics/engine.rb">lib/redis_analytics/engine.rb</a></td> - <td class="red strong">80.0 %</td> - <td>18</td> - <td>10</td> - <td>8</td> - <td>2</td> + <td class="red strong">75.0 %</td> + <td>25</td> + <td>12</td> + <td>9</td> + <td>3</td> <td>0.8</td> </tr> <tr> <td class="strong"><a href="#d8260f765f0e7fbb3f45d2dd48a4b3ef51f428dc" class="src_link" title="lib/redis_analytics/filter.rb">lib/redis_analytics/filter.rb</a></td> @@ -313,29 +313,29 @@ <ol> <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby"> module RedisAnalytics</code> + <code class="ruby">module RedisAnalytics</code> </li> <li class="covered" data-hits="1" data-linenumber="2"> <span class="hits">1</span> - <code class="ruby"> module Configuration</code> + <code class="ruby"> module Configuration</code> </li> <li class="never" data-hits="" data-linenumber="3"> - <code class="ruby"> # Redis connection instance</code> + <code class="ruby"> # Redis connection instance</code> </li> <li class="covered" data-hits="1" data-linenumber="4"> <span class="hits">1</span> - <code class="ruby"> attr_accessor :redis_connection</code> + <code class="ruby"> attr_accessor :redis_connection</code> </li> <li class="never" data-hits="" data-linenumber="5"> @@ -343,17 +343,17 @@ </li> <li class="never" data-hits="" data-linenumber="6"> - <code class="ruby"> # Redis namespace for keys</code> + <code class="ruby"> # Redis namespace for keys</code> </li> <li class="covered" data-hits="1" data-linenumber="7"> <span class="hits">1</span> - <code class="ruby"> attr_writer :redis_namespace</code> + <code class="ruby"> attr_writer :redis_namespace</code> </li> <li class="never" data-hits="" data-linenumber="8"> @@ -361,17 +361,17 @@ </li> <li class="never" data-hits="" data-linenumber="9"> - <code class="ruby"> # Name of the cookie which tracks first visitors</code> + <code class="ruby"> # Name of the cookie which tracks first visitors</code> </li> <li class="covered" data-hits="1" data-linenumber="10"> <span class="hits">1</span> - <code class="ruby"> attr_writer :first_visit_cookie_name</code> + <code class="ruby"> attr_writer :first_visit_cookie_name</code> </li> <li class="never" data-hits="" data-linenumber="11"> @@ -379,17 +379,17 @@ </li> <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> # Name of the cookie which tracks current visits</code> + <code class="ruby"> # Name of the cookie which tracks current visits</code> </li> <li class="covered" data-hits="1" data-linenumber="13"> <span class="hits">1</span> - <code class="ruby"> attr_writer :current_visit_cookie_name</code> + <code class="ruby"> attr_writer :current_visit_cookie_name</code> </li> <li class="never" data-hits="" data-linenumber="14"> @@ -397,17 +397,17 @@ </li> <li class="never" data-hits="" data-linenumber="15"> - <code class="ruby"> # Minutes the visit should timeout after (if no hit is received)</code> + <code class="ruby"> # Minutes the visit should timeout after (if no hit is received)</code> </li> <li class="covered" data-hits="1" data-linenumber="16"> <span class="hits">1</span> - <code class="ruby"> attr_writer :visit_timeout</code> + <code class="ruby"> attr_writer :visit_timeout</code> </li> <li class="never" data-hits="" data-linenumber="17"> @@ -415,17 +415,17 @@ </li> <li class="never" data-hits="" data-linenumber="18"> - <code class="ruby"> # Endpoint for dashboard</code> + <code class="ruby"> # Endpoint for dashboard</code> </li> <li class="covered" data-hits="1" data-linenumber="19"> <span class="hits">1</span> - <code class="ruby"> attr_writer :dashboard_endpoint</code> + <code class="ruby"> attr_writer :dashboard_endpoint</code> </li> <li class="never" data-hits="" data-linenumber="20"> @@ -433,17 +433,17 @@ </li> <li class="never" data-hits="" data-linenumber="21"> - <code class="ruby"> # Endpoint for api</code> + <code class="ruby"> # Endpoint for api</code> </li> <li class="covered" data-hits="1" data-linenumber="22"> <span class="hits">1</span> - <code class="ruby"> attr_writer :api_endpoint</code> + <code class="ruby"> attr_writer :api_endpoint</code> </li> <li class="never" data-hits="" data-linenumber="23"> @@ -451,11 +451,11 @@ </li> <li class="covered" data-hits="1" data-linenumber="24"> <span class="hits">1</span> - <code class="ruby"> attr_writer :path_filters</code> + <code class="ruby"> attr_writer :path_filters</code> </li> <li class="never" data-hits="" data-linenumber="25"> @@ -463,11 +463,11 @@ </li> <li class="covered" data-hits="1" data-linenumber="26"> <span class="hits">1</span> - <code class="ruby"> attr_writer :filters</code> + <code class="ruby"> attr_writer :filters</code> </li> <li class="never" data-hits="" data-linenumber="27"> @@ -475,17 +475,17 @@ </li> <li class="never" data-hits="" data-linenumber="28"> - <code class="ruby"> # Path to the Geo IP Database file</code> + <code class="ruby"> # Path to the Geo IP Database file</code> </li> <li class="covered" data-hits="1" data-linenumber="29"> <span class="hits">1</span> - <code class="ruby"> attr_writer :geo_ip_data_path</code> + <code class="ruby"> attr_writer :geo_ip_data_path</code> </li> <li class="never" data-hits="" data-linenumber="30"> @@ -493,29 +493,29 @@ </li> <li class="never" data-hits="" data-linenumber="31"> - <code class="ruby"> # Redis namespace for keys</code> + <code class="ruby"> # Redis namespace for keys</code> </li> <li class="covered" data-hits="1" data-linenumber="32"> <span class="hits">1</span> - <code class="ruby"> def redis_namespace</code> + <code class="ruby"> def redis_namespace</code> </li> <li class="covered" data-hits="6" data-linenumber="33"> <span class="hits">6</span> - <code class="ruby"> @redis_namespace ||= &#39;ra&#39;</code> + <code class="ruby"> @redis_namespace ||= &#39;ra&#39;</code> </li> <li class="never" data-hits="" data-linenumber="34"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="35"> @@ -523,29 +523,29 @@ </li> <li class="never" data-hits="" data-linenumber="36"> - <code class="ruby"> # Minutes the visit should timeout after (if no hit is received)</code> + <code class="ruby"> # Minutes the visit should timeout after (if no hit is received)</code> </li> <li class="covered" data-hits="1" data-linenumber="37"> <span class="hits">1</span> - <code class="ruby"> def visit_timeout</code> + <code class="ruby"> def visit_timeout</code> </li> <li class="covered" data-hits="6" data-linenumber="38"> <span class="hits">6</span> - <code class="ruby"> @visit_timeout ||= 30 # minutes</code> + <code class="ruby"> @visit_timeout ||= 30 # minutes</code> </li> <li class="never" data-hits="" data-linenumber="39"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="40"> @@ -553,29 +553,29 @@ </li> <li class="never" data-hits="" data-linenumber="41"> - <code class="ruby"> # Name of the cookie which tracks first visitors (unknown visitors)</code> + <code class="ruby"> # Name of the cookie which tracks first visitors (unknown visitors)</code> </li> <li class="covered" data-hits="1" data-linenumber="42"> <span class="hits">1</span> - <code class="ruby"> def first_visit_cookie_name</code> + <code class="ruby"> def first_visit_cookie_name</code> </li> <li class="covered" data-hits="22" data-linenumber="43"> <span class="hits">22</span> - <code class="ruby"> @first_visit_cookie_name ||= &#39;_rucn&#39;</code> + <code class="ruby"> @first_visit_cookie_name ||= &#39;_rucn&#39;</code> </li> <li class="never" data-hits="" data-linenumber="44"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="45"> @@ -583,29 +583,29 @@ </li> <li class="never" data-hits="" data-linenumber="46"> - <code class="ruby"> # Name of the cookie which tracks visits</code> + <code class="ruby"> # Name of the cookie which tracks visits</code> </li> <li class="covered" data-hits="1" data-linenumber="47"> <span class="hits">1</span> - <code class="ruby"> def current_visit_cookie_name</code> + <code class="ruby"> def current_visit_cookie_name</code> </li> <li class="covered" data-hits="29" data-linenumber="48"> <span class="hits">29</span> - <code class="ruby"> @current_visit_cookie_name ||= &#39;_vcn&#39;</code> + <code class="ruby"> @current_visit_cookie_name ||= &#39;_vcn&#39;</code> </li> <li class="never" data-hits="" data-linenumber="49"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="50"> @@ -613,23 +613,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="51"> <span class="hits">1</span> - <code class="ruby"> def filters</code> + <code class="ruby"> def filters</code> </li> <li class="covered" data-hits="6" data-linenumber="52"> <span class="hits">6</span> - <code class="ruby"> @filters ||= []</code> + <code class="ruby"> @filters ||= []</code> </li> <li class="never" data-hits="" data-linenumber="53"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="54"> @@ -637,23 +637,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="55"> <span class="hits">1</span> - <code class="ruby"> def path_filters</code> + <code class="ruby"> def path_filters</code> </li> <li class="covered" data-hits="6" data-linenumber="56"> <span class="hits">6</span> - <code class="ruby"> @path_filters ||= []</code> + <code class="ruby"> @path_filters ||= []</code> </li> <li class="never" data-hits="" data-linenumber="57"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="58"> @@ -661,23 +661,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="59"> <span class="hits">1</span> - <code class="ruby"> def add_filter(&amp;proc)</code> + <code class="ruby"> def add_filter(&amp;proc)</code> </li> <li class="covered" data-hits="1" data-linenumber="60"> <span class="hits">1</span> - <code class="ruby"> filters &lt;&lt; RedisAnalytics::Filter.new(proc)</code> + <code class="ruby"> filters &lt;&lt; RedisAnalytics::Filter.new(proc)</code> </li> <li class="never" data-hits="" data-linenumber="61"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="62"> @@ -685,23 +685,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="63"> <span class="hits">1</span> - <code class="ruby"> def add_path_filter(path)</code> + <code class="ruby"> def add_path_filter(path)</code> </li> <li class="covered" data-hits="1" data-linenumber="64"> <span class="hits">1</span> - <code class="ruby"> path_filters &lt;&lt; RedisAnalytics::PathFilter.new(path)</code> + <code class="ruby"> path_filters &lt;&lt; RedisAnalytics::PathFilter.new(path)</code> </li> <li class="never" data-hits="" data-linenumber="65"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="66"> @@ -709,23 +709,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="67"> <span class="hits">1</span> - <code class="ruby"> def geo_ip_data_path</code> + <code class="ruby"> def geo_ip_data_path</code> </li> <li class="covered" data-hits="3" data-linenumber="68"> <span class="hits">3</span> - <code class="ruby"> @geo_ip_data_path = ::File.expand_path(::File.join(::File.dirname(__FILE__),&#39;..&#39;,&#39;..&#39;)) + &quot;/bin/GeoIP.dat&quot;</code> + <code class="ruby"> @geo_ip_data_path = ::File.expand_path(::File.join(::File.dirname(__FILE__),&#39;..&#39;,&#39;..&#39;)) + &quot;/bin/GeoIP.dat&quot;</code> </li> <li class="never" data-hits="" data-linenumber="69"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="70"> @@ -733,23 +733,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="71"> <span class="hits">1</span> - <code class="ruby"> def visitor_recency_slices</code> + <code class="ruby"> def visitor_recency_slices</code> </li> <li class="covered" data-hits="2" data-linenumber="72"> <span class="hits">2</span> - <code class="ruby"> @visitor_recency_slices ||= [1, 7, 30]</code> + <code class="ruby"> @visitor_recency_slices ||= [1, 7, 30]</code> </li> <li class="never" data-hits="" data-linenumber="73"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="74"> @@ -757,23 +757,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="75"> <span class="hits">1</span> - <code class="ruby"> def default_range</code> + <code class="ruby"> def default_range</code> </li> <li class="covered" data-hits="3" data-linenumber="76"> <span class="hits">3</span> - <code class="ruby"> @default_range = :day</code> + <code class="ruby"> @default_range = :day</code> </li> <li class="never" data-hits="" data-linenumber="77"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="78"> @@ -781,23 +781,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="79"> <span class="hits">1</span> - <code class="ruby"> def redis_key_timestamps # [format, expire in seconds or nil]</code> + <code class="ruby"> def redis_key_timestamps # [format, expire in seconds or nil]</code> </li> <li class="covered" data-hits="40" data-linenumber="80"> <span class="hits">40</span> - <code class="ruby"> [&#39;%Y&#39;, &#39;%Y_%m&#39;, &#39;%Y_%m_%d&#39;, &#39;%Y_%m_%d_%H&#39;, &#39;%Y_%m_%d_%H_%M&#39;]</code> + <code class="ruby"> [&#39;%Y&#39;, &#39;%Y_%m&#39;, &#39;%Y_%m_%d&#39;, &#39;%Y_%m_%d_%H&#39;, &#39;%Y_%m_%d_%H_%M&#39;]</code> </li> <li class="never" data-hits="" data-linenumber="81"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="82"> @@ -805,23 +805,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="83"> <span class="hits">1</span> - <code class="ruby"> def time_range_formats</code> + <code class="ruby"> def time_range_formats</code> </li> <li class="covered" data-hits="2" data-linenumber="84"> <span class="hits">2</span> - <code class="ruby"> [[:year, :month, &quot;%b&quot;], [:week, :day, &quot;%a&quot;], [:day, :hour, &quot;%l%P&quot;]]</code> + <code class="ruby"> [[:year, :month, &quot;%b&quot;], [:week, :day, &quot;%a&quot;], [:day, :hour, &quot;%l%P&quot;]]</code> </li> <li class="never" data-hits="" data-linenumber="85"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="86"> @@ -829,23 +829,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="87"> <span class="hits">1</span> - <code class="ruby"> def configure</code> + <code class="ruby"> def configure</code> </li> <li class="covered" data-hits="6" data-linenumber="88"> <span class="hits">6</span> - <code class="ruby"> yield self</code> + <code class="ruby"> yield self</code> </li> <li class="never" data-hits="" data-linenumber="89"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="90"> @@ -853,23 +853,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="91"> <span class="hits">1</span> - <code class="ruby"> def api_endpoint</code> + <code class="ruby"> def api_endpoint</code> </li> <li class="missed" data-hits="0" data-linenumber="92"> - <code class="ruby"> @api_endpoint || dashboard_endpoint + &#39;/api&#39;</code> + <code class="ruby"> @api_endpoint || dashboard_endpoint + &#39;/api&#39;</code> </li> <li class="never" data-hits="" data-linenumber="93"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="94"> @@ -877,23 +877,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="95"> <span class="hits">1</span> - <code class="ruby"> def dashboard_endpoint</code> + <code class="ruby"> def dashboard_endpoint</code> </li> <li class="missed" data-hits="0" data-linenumber="96"> - <code class="ruby"> @dashboard_endpoint || &#39;/redis_analytics&#39;</code> + <code class="ruby"> @dashboard_endpoint || &#39;/redis_analytics&#39;</code> </li> <li class="never" data-hits="" data-linenumber="97"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="98"> @@ -901,17 +901,17 @@ </li> <li class="never" data-hits="" data-linenumber="99"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="100"> - <code class="ruby"> end</code> + <code class="ruby">end</code> </li> <li class="never" data-hits="" data-linenumber="101"> @@ -923,15 +923,15 @@ </div> <div class="source_table" id="092dae03526444499262440a90b632344ec5532e"> <div class="header"> <h3>lib/redis_analytics/engine.rb</h3> - <h4><span class="red">80.0 %</span> covered</h4> + <h4><span class="red">75.0 %</span> covered</h4> <div> - <b>10</b> relevant lines. - <span class="green"><b>8</b> lines covered</span> and - <span class="red"><b>2</b> lines missed.</span> + <b>12</b> relevant lines. + <span class="green"><b>9</b> lines covered</span> and + <span class="red"><b>3</b> lines missed.</span> </div> </div> <pre> <ol> @@ -967,80 +967,122 @@ </li> <li class="covered" data-hits="1" data-linenumber="6"> <span class="hits">1</span> - <code class="ruby"> class Engine &lt; ::Rails::Engine</code> + <code class="ruby"> class Engine &lt; ::Rails::Engine</code> </li> <li class="covered" data-hits="1" data-linenumber="7"> <span class="hits">1</span> - <code class="ruby"> isolate_namespace RedisAnalytics</code> + <code class="ruby"> isolate_namespace RedisAnalytics</code> </li> <li class="never" data-hits="" data-linenumber="8"> - <code class="ruby"> </code> + <code class="ruby"> </code> </li> <li class="covered" data-hits="1" data-linenumber="9"> <span class="hits">1</span> - <code class="ruby"> initializer &quot;redis_analytics.middleware&quot; do |app|</code> + <code class="ruby"> initializer &quot;redis_analytics.middleware&quot; do |app|</code> </li> <li class="missed" data-hits="0" data-linenumber="10"> - <code class="ruby"> app.config.app_middleware.use &quot;RedisAnalytics::Tracker&quot;</code> + <code class="ruby"> app.config.app_middleware.use &quot;RedisAnalytics::Tracker&quot;</code> </li> <li class="never" data-hits="" data-linenumber="11"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> </code> + <code class="ruby"> </code> </li> <li class="covered" data-hits="1" data-linenumber="13"> <span class="hits">1</span> - <code class="ruby"> initializer &quot;redis_analytics.view_helpers&quot; do |app|</code> + <code class="ruby"> initializer &quot;redis_analytics.view_helpers&quot; do |app|</code> </li> <li class="missed" data-hits="0" data-linenumber="14"> - <code class="ruby"> ActionController::Base.send :include, RedisAnalytics::Helpers</code> + <code class="ruby"> ActionController::Base.send :include, RedisAnalytics::Helpers</code> </li> <li class="never" data-hits="" data-linenumber="15"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="16"> - <code class="ruby"> end</code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="covered" data-hits="1" data-linenumber="17"> + <span class="hits">1</span> + <code class="ruby"> initializer &quot;redis_analytics.precompile.hook&quot;, group: :all do |app|</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="18"> + + <code class="ruby"> app.config.assets.precompile += %w[</code> + </li> + + <li class="never" data-hits="" data-linenumber="19"> + + + <code class="ruby"> redis_analytics/redis_analytics.js</code> + </li> + + <li class="never" data-hits="" data-linenumber="20"> + + + <code class="ruby"> redis_analytics/redis_analytics.css</code> + </li> + + <li class="never" data-hits="" data-linenumber="21"> + + + <code class="ruby"> ]</code> + </li> + + <li class="never" data-hits="" data-linenumber="22"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="23"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="24"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="18"> + <li class="never" data-hits="" data-linenumber="25"> <code class="ruby">end</code> </li> @@ -1063,23 +1105,23 @@ <ol> <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby"> module RedisAnalytics</code> + <code class="ruby">module RedisAnalytics</code> </li> <li class="covered" data-hits="1" data-linenumber="2"> <span class="hits">1</span> - <code class="ruby"> class Filter</code> + <code class="ruby"> class Filter</code> </li> <li class="covered" data-hits="1" data-linenumber="3"> <span class="hits">1</span> - <code class="ruby"> attr_reader :filter_proc</code> + <code class="ruby"> attr_reader :filter_proc</code> </li> <li class="never" data-hits="" data-linenumber="4"> @@ -1087,23 +1129,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="5"> <span class="hits">1</span> - <code class="ruby"> def initialize(filter_proc)</code> + <code class="ruby"> def initialize(filter_proc)</code> </li> <li class="covered" data-hits="2" data-linenumber="6"> <span class="hits">2</span> - <code class="ruby"> @filter_proc = filter_proc</code> + <code class="ruby"> @filter_proc = filter_proc</code> </li> <li class="never" data-hits="" data-linenumber="7"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="8"> @@ -1111,23 +1153,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="9"> <span class="hits">1</span> - <code class="ruby"> def matches?(request, response)</code> + <code class="ruby"> def matches?(request, response)</code> </li> <li class="covered" data-hits="5" data-linenumber="10"> <span class="hits">5</span> - <code class="ruby"> filter_proc.call(request, response)</code> + <code class="ruby"> filter_proc.call(request, response)</code> </li> <li class="never" data-hits="" data-linenumber="11"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="12"> @@ -1135,11 +1177,11 @@ </li> <li class="never" data-hits="" data-linenumber="13"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="14"> @@ -1147,17 +1189,17 @@ </li> <li class="covered" data-hits="1" data-linenumber="15"> <span class="hits">1</span> - <code class="ruby"> class PathFilter</code> + <code class="ruby"> class PathFilter</code> </li> <li class="covered" data-hits="1" data-linenumber="16"> <span class="hits">1</span> - <code class="ruby"> attr_reader :filter_path</code> + <code class="ruby"> attr_reader :filter_path</code> </li> <li class="never" data-hits="" data-linenumber="17"> @@ -1165,23 +1207,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="18"> <span class="hits">1</span> - <code class="ruby"> def initialize(filter_path)</code> + <code class="ruby"> def initialize(filter_path)</code> </li> <li class="covered" data-hits="3" data-linenumber="19"> <span class="hits">3</span> - <code class="ruby"> @filter_path = filter_path</code> + <code class="ruby"> @filter_path = filter_path</code> </li> <li class="never" data-hits="" data-linenumber="20"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="21"> @@ -1189,53 +1231,53 @@ </li> <li class="covered" data-hits="1" data-linenumber="22"> <span class="hits">1</span> - <code class="ruby"> def matches?(request_path)</code> + <code class="ruby"> def matches?(request_path)</code> </li> <li class="covered" data-hits="6" data-linenumber="23"> <span class="hits">6</span> - <code class="ruby"> if filter_path.is_a?(String)</code> + <code class="ruby"> if filter_path.is_a?(String)</code> </li> <li class="covered" data-hits="5" data-linenumber="24"> <span class="hits">5</span> - <code class="ruby"> request_path == filter_path</code> + <code class="ruby"> request_path == filter_path</code> </li> <li class="covered" data-hits="1" data-linenumber="25"> <span class="hits">1</span> - <code class="ruby"> elsif filter_path.is_a?(Regexp)</code> + <code class="ruby"> elsif filter_path.is_a?(Regexp)</code> </li> <li class="covered" data-hits="1" data-linenumber="26"> <span class="hits">1</span> - <code class="ruby"> request_path =~ filter_path</code> + <code class="ruby"> request_path =~ filter_path</code> </li> <li class="never" data-hits="" data-linenumber="27"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="28"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="29"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="30"> @@ -1243,11 +1285,11 @@ </li> <li class="never" data-hits="" data-linenumber="31"> - <code class="ruby"> end</code> + <code class="ruby">end</code> </li> <li class="never" data-hits="" data-linenumber="32"> @@ -1273,17 +1315,17 @@ <ol> <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby"> module RedisAnalytics</code> + <code class="ruby">module RedisAnalytics</code> </li> <li class="covered" data-hits="1" data-linenumber="2"> <span class="hits">1</span> - <code class="ruby"> module Helpers</code> + <code class="ruby"> module Helpers</code> </li> <li class="never" data-hits="" data-linenumber="3"> @@ -1291,11 +1333,11 @@ </li> <li class="covered" data-hits="1" data-linenumber="4"> <span class="hits">1</span> - <code class="ruby"> FORMAT_SPECIFIER = [[&#39;%Y&#39;, 365], [&#39;%m&#39;, 30], [&#39;%d&#39;, 24], [&#39;%H&#39;, 60], [&#39;%M&#39;, 60]]</code> + <code class="ruby"> FORMAT_SPECIFIER = [[&#39;%Y&#39;, 365], [&#39;%m&#39;, 30], [&#39;%d&#39;, 24], [&#39;%H&#39;, 60], [&#39;%M&#39;, 60]]</code> </li> <li class="never" data-hits="" data-linenumber="5"> @@ -1303,11 +1345,11 @@ </li> <li class="covered" data-hits="1" data-linenumber="6"> <span class="hits">1</span> - <code class="ruby"> GRANULARITY = [&#39;yearly&#39;, &#39;monthly&#39;, &#39;dayly&#39;, &#39;hourly&#39;, &#39;minutely&#39;]</code> + <code class="ruby"> GRANULARITY = [&#39;yearly&#39;, &#39;monthly&#39;, &#39;dayly&#39;, &#39;hourly&#39;, &#39;minutely&#39;]</code> </li> <li class="never" data-hits="" data-linenumber="7"> @@ -1315,65 +1357,65 @@ </li> <li class="covered" data-hits="1" data-linenumber="8"> <span class="hits">1</span> - <code class="ruby"> private</code> + <code class="ruby"> private</code> </li> <li class="covered" data-hits="1" data-linenumber="9"> <span class="hits">1</span> - <code class="ruby"> def method_missing(meth, *args, &amp;block)</code> + <code class="ruby"> def method_missing(meth, *args, &amp;block)</code> </li> <li class="missed" data-hits="0" data-linenumber="10"> - <code class="ruby"> if meth.to_s =~ /^(minute|hour|dai|day|month|year)ly_([a-z_0-9]+)$/</code> + <code class="ruby"> if meth.to_s =~ /^(minute|hour|dai|day|month|year)ly_([a-z_0-9]+)$/</code> </li> <li class="missed" data-hits="0" data-linenumber="11"> - <code class="ruby"> granularity = ($1 == &#39;dai&#39; ? &#39;day&#39; : $1) + &#39;ly&#39;</code> + <code class="ruby"> granularity = ($1 == &#39;dai&#39; ? &#39;day&#39; : $1) + &#39;ly&#39;</code> </li> <li class="missed" data-hits="0" data-linenumber="12"> - <code class="ruby"> metric_name = $2</code> + <code class="ruby"> metric_name = $2</code> </li> <li class="missed" data-hits="0" data-linenumber="13"> - <code class="ruby"> data(granularity, metric_name, *args)</code> + <code class="ruby"> data(granularity, metric_name, *args)</code> </li> <li class="never" data-hits="" data-linenumber="14"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="missed" data-hits="0" data-linenumber="15"> - <code class="ruby"> super</code> + <code class="ruby"> super</code> </li> <li class="never" data-hits="" data-linenumber="16"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="17"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="18"> @@ -1381,23 +1423,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="19"> <span class="hits">1</span> - <code class="ruby"> def metric_type(metric_name)</code> + <code class="ruby"> def metric_type(metric_name)</code> </li> <li class="missed" data-hits="0" data-linenumber="20"> - <code class="ruby"> RedisAnalytics.redis_connection.hget(&quot;#{RedisAnalytics.redis_namespace}:#METRICS&quot;, metric_name)</code> + <code class="ruby"> RedisAnalytics.redis_connection.hget(&quot;#{RedisAnalytics.redis_namespace}:#METRICS&quot;, metric_name)</code> </li> <li class="never" data-hits="" data-linenumber="21"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="22"> @@ -1405,23 +1447,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="23"> <span class="hits">1</span> - <code class="ruby"> def data(granularity, metric_name, from_date, options = {})</code> + <code class="ruby"> def data(granularity, metric_name, from_date, options = {})</code> </li> <li class="missed" data-hits="0" data-linenumber="24"> - <code class="ruby"> aggregate = options[:aggregate] || false</code> + <code class="ruby"> aggregate = options[:aggregate] || false</code> </li> <li class="missed" data-hits="0" data-linenumber="25"> - <code class="ruby"> x = granularity[0..-3]</code> + <code class="ruby"> x = granularity[0..-3]</code> </li> <li class="never" data-hits="" data-linenumber="26"> @@ -1429,17 +1471,17 @@ </li> <li class="missed" data-hits="0" data-linenumber="27"> - <code class="ruby"> to_date = (options[:to_date] || Time.now).send(&quot;end_of_#{x}&quot;)</code> + <code class="ruby"> to_date = (options[:to_date] || Time.now).send(&quot;end_of_#{x}&quot;)</code> </li> <li class="missed" data-hits="0" data-linenumber="28"> - <code class="ruby"> i = from_date.send(&quot;beginning_of_#{x}&quot;)</code> + <code class="ruby"> i = from_date.send(&quot;beginning_of_#{x}&quot;)</code> </li> <li class="never" data-hits="" data-linenumber="29"> @@ -1447,209 +1489,209 @@ </li> <li class="missed" data-hits="0" data-linenumber="30"> - <code class="ruby"> union = []</code> + <code class="ruby"> union = []</code> </li> <li class="missed" data-hits="0" data-linenumber="31"> - <code class="ruby"> time = []</code> + <code class="ruby"> time = []</code> </li> <li class="never" data-hits="" data-linenumber="32"> - <code class="ruby"> begin</code> + <code class="ruby"> begin</code> </li> <li class="missed" data-hits="0" data-linenumber="33"> - <code class="ruby"> slice_key = i.strftime(FORMAT_SPECIFIER[0..GRANULARITY.index(granularity)].map{|x| x[0]}.join(&#39;_&#39;))</code> + <code class="ruby"> slice_key = i.strftime(FORMAT_SPECIFIER[0..GRANULARITY.index(granularity)].map{|x| x[0]}.join(&#39;_&#39;))</code> </li> <li class="missed" data-hits="0" data-linenumber="34"> - <code class="ruby"> union &lt;&lt; &quot;#{RedisAnalytics.redis_namespace}:#{metric_name}:#{slice_key}&quot;</code> + <code class="ruby"> union &lt;&lt; &quot;#{RedisAnalytics.redis_namespace}:#{metric_name}:#{slice_key}&quot;</code> </li> <li class="missed" data-hits="0" data-linenumber="35"> - <code class="ruby"> time &lt;&lt; slice_key.split(&#39;_&#39;)</code> + <code class="ruby"> time &lt;&lt; slice_key.split(&#39;_&#39;)</code> </li> <li class="missed" data-hits="0" data-linenumber="36"> - <code class="ruby"> i += 1.send(x)</code> + <code class="ruby"> i += 1.send(x)</code> </li> <li class="missed" data-hits="0" data-linenumber="37"> - <code class="ruby"> end while i &lt;= to_date</code> + <code class="ruby"> end while i &lt;= to_date</code> </li> <li class="missed" data-hits="0" data-linenumber="38"> - <code class="ruby"> seq = get_next_seq</code> + <code class="ruby"> seq = get_next_seq</code> </li> <li class="missed" data-hits="0" data-linenumber="39"> - <code class="ruby"> if metric_type(metric_name) == &#39;String&#39;</code> + <code class="ruby"> if metric_type(metric_name) == &#39;String&#39;</code> </li> <li class="missed" data-hits="0" data-linenumber="40"> - <code class="ruby"> if aggregate</code> + <code class="ruby"> if aggregate</code> </li> <li class="missed" data-hits="0" data-linenumber="41"> - <code class="ruby"> union_key = &quot;#{RedisAnalytics.redis_namespace}:#{seq}&quot;</code> + <code class="ruby"> union_key = &quot;#{RedisAnalytics.redis_namespace}:#{seq}&quot;</code> </li> <li class="missed" data-hits="0" data-linenumber="42"> - <code class="ruby"> RedisAnalytics.redis_connection.zunionstore(union_key, union)</code> + <code class="ruby"> RedisAnalytics.redis_connection.zunionstore(union_key, union)</code> </li> <li class="missed" data-hits="0" data-linenumber="43"> - <code class="ruby"> RedisAnalytics.redis_connection.expire(union_key, 100)</code> + <code class="ruby"> RedisAnalytics.redis_connection.expire(union_key, 100)</code> </li> <li class="missed" data-hits="0" data-linenumber="44"> - <code class="ruby"> return Hash[RedisAnalytics.redis_connection.zrange(union_key, 0, -1, :with_scores =&gt; true)]</code> + <code class="ruby"> return Hash[RedisAnalytics.redis_connection.zrange(union_key, 0, -1, :with_scores =&gt; true)]</code> </li> <li class="never" data-hits="" data-linenumber="45"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="missed" data-hits="0" data-linenumber="46"> - <code class="ruby"> return time.zip(union.map{|x| Hash[RedisAnalytics.redis_connection.zrange(x, 0, -1, :with_scores =&gt; true)]})</code> + <code class="ruby"> return time.zip(union.map{|x| Hash[RedisAnalytics.redis_connection.zrange(x, 0, -1, :with_scores =&gt; true)]})</code> </li> <li class="never" data-hits="" data-linenumber="47"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="missed" data-hits="0" data-linenumber="48"> - <code class="ruby"> elsif metric_type(metric_name) == &#39;Fixnum&#39;</code> + <code class="ruby"> elsif metric_type(metric_name) == &#39;Fixnum&#39;</code> </li> <li class="missed" data-hits="0" data-linenumber="49"> - <code class="ruby"> if aggregate</code> + <code class="ruby"> if aggregate</code> </li> <li class="missed" data-hits="0" data-linenumber="50"> - <code class="ruby"> return RedisAnalytics.redis_connection.mget(*union).map(&amp;:to_i).inject(:+)</code> + <code class="ruby"> return RedisAnalytics.redis_connection.mget(*union).map(&amp;:to_i).inject(:+)</code> </li> <li class="never" data-hits="" data-linenumber="51"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="missed" data-hits="0" data-linenumber="52"> - <code class="ruby"> return time.zip(RedisAnalytics.redis_connection.mget(*union).map(&amp;:to_i))</code> + <code class="ruby"> return time.zip(RedisAnalytics.redis_connection.mget(*union).map(&amp;:to_i))</code> </li> <li class="never" data-hits="" data-linenumber="53"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="54"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="missed" data-hits="0" data-linenumber="55"> - <code class="ruby"> if Metrics.public_instance_methods.any?{|m| m.to_s =~ /^#{metric_name}_ratio_per_(hit|visit)$/}</code> + <code class="ruby"> if Metrics.public_instance_methods.any?{|m| m.to_s =~ /^#{metric_name}_ratio_per_(hit|visit)$/}</code> </li> <li class="missed" data-hits="0" data-linenumber="56"> - <code class="ruby"> aggregate ? {} : time.zip([{}] * time.length)</code> + <code class="ruby"> aggregate ? {} : time.zip([{}] * time.length)</code> </li> <li class="missed" data-hits="0" data-linenumber="57"> - <code class="ruby"> elsif Metrics.public_instance_methods.any?{|m| m.to_s =~ /^#{metric_name}_count_per_(hit|visit)$/}</code> + <code class="ruby"> elsif Metrics.public_instance_methods.any?{|m| m.to_s =~ /^#{metric_name}_count_per_(hit|visit)$/}</code> </li> <li class="missed" data-hits="0" data-linenumber="58"> - <code class="ruby"> aggregate ? 0 : time.zip([0] * time.length)</code> + <code class="ruby"> aggregate ? 0 : time.zip([0] * time.length)</code> </li> <li class="never" data-hits="" data-linenumber="59"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="missed" data-hits="0" data-linenumber="60"> - <code class="ruby"> aggregate ? 0 : time.zip([0] * time.length)</code> + <code class="ruby"> aggregate ? 0 : time.zip([0] * time.length)</code> </li> <li class="never" data-hits="" data-linenumber="61"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="62"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="63"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="64"> @@ -1657,23 +1699,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="65"> <span class="hits">1</span> - <code class="ruby"> def get_next_seq</code> + <code class="ruby"> def get_next_seq</code> </li> <li class="missed" data-hits="0" data-linenumber="66"> - <code class="ruby"> seq = RedisAnalytics.redis_connection.incr(&quot;#{RedisAnalytics.redis_namespace}:#SEQUENCER&quot;)</code> + <code class="ruby"> seq = RedisAnalytics.redis_connection.incr(&quot;#{RedisAnalytics.redis_namespace}:#SEQUENCER&quot;)</code> </li> <li class="never" data-hits="" data-linenumber="67"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="68"> @@ -1681,35 +1723,35 @@ </li> <li class="covered" data-hits="1" data-linenumber="69"> <span class="hits">1</span> - <code class="ruby"> def time_range</code> + <code class="ruby"> def time_range</code> </li> <li class="missed" data-hits="0" data-linenumber="70"> - <code class="ruby"> (request.cookies[&quot;_rarng&quot;] || RedisAnalytics.default_range).to_sym</code> + <code class="ruby"> (request.cookies[&quot;_rarng&quot;] || RedisAnalytics.default_range).to_sym</code> </li> <li class="never" data-hits="" data-linenumber="71"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="72"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="73"> - <code class="ruby"> end</code> + <code class="ruby">end</code> </li> <li class="never" data-hits="" data-linenumber="74"> @@ -1735,17 +1777,17 @@ <ol> <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby"> module RedisAnalytics</code> + <code class="ruby">module RedisAnalytics</code> </li> <li class="covered" data-hits="1" data-linenumber="2"> <span class="hits">1</span> - <code class="ruby"> module Metrics</code> + <code class="ruby"> module Metrics</code> </li> <li class="never" data-hits="" data-linenumber="3"> @@ -1753,29 +1795,29 @@ </li> <li class="covered" data-hits="1" data-linenumber="4"> <span class="hits">1</span> - <code class="ruby"> attr_reader :visit_time_count_per_visit</code> + <code class="ruby"> attr_reader :visit_time_count_per_visit</code> </li> <li class="covered" data-hits="1" data-linenumber="5"> <span class="hits">1</span> - <code class="ruby"> attr_reader :visits_count_per_visit, :first_visits_count_per_visit, :repeat_visits_count_per_visit</code> + <code class="ruby"> attr_reader :visits_count_per_visit, :first_visits_count_per_visit, :repeat_visits_count_per_visit</code> </li> <li class="covered" data-hits="1" data-linenumber="6"> <span class="hits">1</span> - <code class="ruby"> attr_reader :unique_visits_ratio_per_visit</code> + <code class="ruby"> attr_reader :unique_visits_ratio_per_visit</code> </li> <li class="covered" data-hits="1" data-linenumber="7"> <span class="hits">1</span> - <code class="ruby"> attr_reader :page_views_count_per_hit, :second_page_views_count_per_hit</code> + <code class="ruby"> attr_reader :page_views_count_per_hit, :second_page_views_count_per_hit</code> </li> <li class="never" data-hits="" data-linenumber="8"> @@ -1783,29 +1825,29 @@ </li> <li class="never" data-hits="" data-linenumber="9"> - <code class="ruby"> # Developers can override or define new public methods here</code> + <code class="ruby"> # Developers can override or define new public methods here</code> </li> <li class="never" data-hits="" data-linenumber="10"> - <code class="ruby"> # Methods should start with track and end with count or types</code> + <code class="ruby"> # Methods should start with track and end with count or types</code> </li> <li class="never" data-hits="" data-linenumber="11"> - <code class="ruby"> # Return types should be Fixnum or String resp.</code> + <code class="ruby"> # Return types should be Fixnum or String resp.</code> </li> <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> # If you return nil or an error nothing will be tracked</code> + <code class="ruby"> # If you return nil or an error nothing will be tracked</code> </li> <li class="never" data-hits="" data-linenumber="13"> @@ -1813,23 +1855,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="14"> <span class="hits">1</span> - <code class="ruby"> def browser_ratio_per_visit</code> + <code class="ruby"> def browser_ratio_per_visit</code> </li> <li class="covered" data-hits="3" data-linenumber="15"> <span class="hits">3</span> - <code class="ruby"> user_agent.name.to_s</code> + <code class="ruby"> user_agent.name.to_s</code> </li> <li class="never" data-hits="" data-linenumber="16"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="17"> @@ -1837,23 +1879,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="18"> <span class="hits">1</span> - <code class="ruby"> def platform_ratio_per_visit</code> + <code class="ruby"> def platform_ratio_per_visit</code> </li> <li class="covered" data-hits="3" data-linenumber="19"> <span class="hits">3</span> - <code class="ruby"> user_agent.platform.to_s</code> + <code class="ruby"> user_agent.platform.to_s</code> </li> <li class="never" data-hits="" data-linenumber="20"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="21"> @@ -1861,83 +1903,83 @@ </li> <li class="covered" data-hits="1" data-linenumber="22"> <span class="hits">1</span> - <code class="ruby"> def country_ratio_per_visit</code> + <code class="ruby"> def country_ratio_per_visit</code> </li> <li class="covered" data-hits="3" data-linenumber="23"> <span class="hits">3</span> - <code class="ruby"> if defined?(GeoIP)</code> + <code class="ruby"> if defined?(GeoIP)</code> </li> <li class="covered" data-hits="3" data-linenumber="24"> <span class="hits">3</span> - <code class="ruby"> begin</code> + <code class="ruby"> begin</code> </li> <li class="covered" data-hits="3" data-linenumber="25"> <span class="hits">3</span> - <code class="ruby"> g = GeoIP.new(RedisAnalytics.geo_ip_data_path)</code> + <code class="ruby"> g = GeoIP.new(RedisAnalytics.geo_ip_data_path)</code> </li> <li class="covered" data-hits="3" data-linenumber="26"> <span class="hits">3</span> - <code class="ruby"> geo_country_code = g.country(@rack_request.ip).to_hash[:country_code2]</code> + <code class="ruby"> geo_country_code = g.country(@rack_request.ip).to_hash[:country_code2]</code> </li> <li class="covered" data-hits="3" data-linenumber="27"> <span class="hits">3</span> - <code class="ruby"> if geo_country_code and geo_country_code =~ /^[A-Z]{2}$/</code> + <code class="ruby"> if geo_country_code and geo_country_code =~ /^[A-Z]{2}$/</code> </li> <li class="missed" data-hits="0" data-linenumber="28"> - <code class="ruby"> return geo_country_code</code> + <code class="ruby"> return geo_country_code</code> </li> <li class="never" data-hits="" data-linenumber="29"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="missed" data-hits="0" data-linenumber="30"> - <code class="ruby"> rescue Exception =&gt; e</code> + <code class="ruby"> rescue Exception =&gt; e</code> </li> <li class="missed" data-hits="0" data-linenumber="31"> - <code class="ruby"> warn &quot;Unable to fetch country info #{e}&quot;</code> + <code class="ruby"> warn &quot;Unable to fetch country info #{e}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="32"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="33"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="34"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="35"> @@ -1945,95 +1987,95 @@ </li> <li class="covered" data-hits="1" data-linenumber="36"> <span class="hits">1</span> - <code class="ruby"> def recency_ratio_per_visit</code> + <code class="ruby"> def recency_ratio_per_visit</code> </li> <li class="never" data-hits="" data-linenumber="37"> - <code class="ruby"> # tracking for visitor recency</code> + <code class="ruby"> # tracking for visitor recency</code> </li> <li class="covered" data-hits="3" data-linenumber="38"> <span class="hits">3</span> - <code class="ruby"> if @last_visit_time # from first_visit_cookie</code> + <code class="ruby"> if @last_visit_time # from first_visit_cookie</code> </li> <li class="missed" data-hits="0" data-linenumber="39"> - <code class="ruby"> days_since_last_visit = ((@t.to_i - @last_visit_time.to_i)/(24*3600)).round</code> + <code class="ruby"> days_since_last_visit = ((@t.to_i - @last_visit_time.to_i)/(24*3600)).round</code> </li> <li class="missed" data-hits="0" data-linenumber="40"> - <code class="ruby"> if days_since_last_visit &lt;= 1</code> + <code class="ruby"> if days_since_last_visit &lt;= 1</code> </li> <li class="missed" data-hits="0" data-linenumber="41"> - <code class="ruby"> return &#39;d&#39;</code> + <code class="ruby"> return &#39;d&#39;</code> </li> <li class="missed" data-hits="0" data-linenumber="42"> - <code class="ruby"> elsif days_since_last_visit &lt;= 7</code> + <code class="ruby"> elsif days_since_last_visit &lt;= 7</code> </li> <li class="missed" data-hits="0" data-linenumber="43"> - <code class="ruby"> return &#39;w&#39;</code> + <code class="ruby"> return &#39;w&#39;</code> </li> <li class="missed" data-hits="0" data-linenumber="44"> - <code class="ruby"> elsif days_since_last_visit &lt;= 30</code> + <code class="ruby"> elsif days_since_last_visit &lt;= 30</code> </li> <li class="missed" data-hits="0" data-linenumber="45"> - <code class="ruby"> return &#39;m&#39;</code> + <code class="ruby"> return &#39;m&#39;</code> </li> <li class="never" data-hits="" data-linenumber="46"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="missed" data-hits="0" data-linenumber="47"> - <code class="ruby"> return &#39;o&#39;</code> + <code class="ruby"> return &#39;o&#39;</code> </li> <li class="never" data-hits="" data-linenumber="48"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="49"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="50"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="51"> @@ -2041,23 +2083,23 @@ </li> <li class="covered" data-hits="1" data-linenumber="52"> <span class="hits">1</span> - <code class="ruby"> def device_ratio_per_visit</code> + <code class="ruby"> def device_ratio_per_visit</code> </li> <li class="covered" data-hits="3" data-linenumber="53"> <span class="hits">3</span> - <code class="ruby"> return ((user_agent.mobile? or user_agent.tablet?) ? &#39;mobile&#39; : &#39;desktop&#39;)</code> + <code class="ruby"> return ((user_agent.mobile? or user_agent.tablet?) ? &#39;mobile&#39; : &#39;desktop&#39;)</code> </li> <li class="never" data-hits="" data-linenumber="54"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="55"> @@ -2065,101 +2107,101 @@ </li> <li class="covered" data-hits="1" data-linenumber="56"> <span class="hits">1</span> - <code class="ruby"> def referrer_ratio_per_visit</code> + <code class="ruby"> def referrer_ratio_per_visit</code> </li> <li class="covered" data-hits="3" data-linenumber="57"> <span class="hits">3</span> - <code class="ruby"> if @rack_request.referrer</code> + <code class="ruby"> if @rack_request.referrer</code> </li> <li class="missed" data-hits="0" data-linenumber="58"> - <code class="ruby"> [&#39;google&#39;, &#39;bing&#39;, &#39;yahoo&#39;, &#39;cleartrip&#39;, &#39;github&#39;].each do |referrer|</code> + <code class="ruby"> [&#39;google&#39;, &#39;bing&#39;, &#39;yahoo&#39;, &#39;cleartrip&#39;, &#39;github&#39;].each do |referrer|</code> </li> <li class="never" data-hits="" data-linenumber="59"> - <code class="ruby"> # this will track x.google.mysite.com as google so its buggy, fix the regex</code> + <code class="ruby"> # this will track x.google.mysite.com as google so its buggy, fix the regex</code> </li> <li class="missed" data-hits="0" data-linenumber="60"> - <code class="ruby"> if m = @rack_request.referrer.match(/^(https?:\/\/)?([a-zA-Z0-9\.\-]+\.)?(#{referrer})\.([a-zA-Z\.]+)(:[0-9]+)?(\/.*)?$/)</code> + <code class="ruby"> if m = @rack_request.referrer.match(/^(https?:\/\/)?([a-zA-Z0-9\.\-]+\.)?(#{referrer})\.([a-zA-Z\.]+)(:[0-9]+)?(\/.*)?$/)</code> </li> <li class="missed" data-hits="0" data-linenumber="61"> - <code class="ruby"> &quot;REFERRER =&gt; #{m.to_a[3]}&quot;</code> + <code class="ruby"> &quot;REFERRER =&gt; #{m.to_a[3]}&quot;</code> </li> <li class="missed" data-hits="0" data-linenumber="62"> - <code class="ruby"> referrer = m.to_a[3]</code> + <code class="ruby"> referrer = m.to_a[3]</code> </li> <li class="never" data-hits="" data-linenumber="63"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="missed" data-hits="0" data-linenumber="64"> - <code class="ruby"> referrer = &#39;other&#39;</code> + <code class="ruby"> referrer = &#39;other&#39;</code> </li> <li class="never" data-hits="" data-linenumber="65"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="66"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="67"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="covered" data-hits="3" data-linenumber="68"> <span class="hits">3</span> - <code class="ruby"> referrer = &#39;organic&#39;</code> + <code class="ruby"> referrer = &#39;organic&#39;</code> </li> <li class="never" data-hits="" data-linenumber="69"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="covered" data-hits="3" data-linenumber="70"> <span class="hits">3</span> - <code class="ruby"> return referrer</code> + <code class="ruby"> return referrer</code> </li> <li class="never" data-hits="" data-linenumber="71"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="72"> @@ -2167,59 +2209,59 @@ </li> <li class="never" data-hits="" data-linenumber="73"> - <code class="ruby"> # track the ratio of URL&#39;s visits</code> + <code class="ruby"> # track the ratio of URL&#39;s visits</code> </li> <li class="covered" data-hits="1" data-linenumber="74"> <span class="hits">1</span> - <code class="ruby"> def url_ratio_per_hit</code> + <code class="ruby"> def url_ratio_per_hit</code> </li> <li class="covered" data-hits="4" data-linenumber="75"> <span class="hits">4</span> - <code class="ruby"> return @rack_request.path</code> + <code class="ruby"> return @rack_request.path</code> </li> <li class="never" data-hits="" data-linenumber="76"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="77"> - <code class="ruby"> </code> + <code class="ruby"> </code> </li> <li class="never" data-hits="" data-linenumber="78"> - <code class="ruby"> # track the landing pages ratio</code> + <code class="ruby"> # track the landing pages ratio</code> </li> <li class="covered" data-hits="1" data-linenumber="79"> <span class="hits">1</span> - <code class="ruby"> def landing_page_ratio_per_hit</code> + <code class="ruby"> def landing_page_ratio_per_hit</code> </li> <li class="covered" data-hits="4" data-linenumber="80"> <span class="hits">4</span> - <code class="ruby"> return @rack_request.path if @page_view_seq_no.to_i == 0</code> + <code class="ruby"> return @rack_request.path if @page_view_seq_no.to_i == 0</code> </li> <li class="never" data-hits="" data-linenumber="81"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="82"> @@ -2227,29 +2269,29 @@ </li> <li class="never" data-hits="" data-linenumber="83"> - <code class="ruby"> # track the landing pages ratio</code> + <code class="ruby"> # track the landing pages ratio</code> </li> <li class="covered" data-hits="1" data-linenumber="84"> <span class="hits">1</span> - <code class="ruby"> def http_response_ratio_per_hit</code> + <code class="ruby"> def http_response_ratio_per_hit</code> </li> <li class="covered" data-hits="4" data-linenumber="85"> <span class="hits">4</span> - <code class="ruby"> return @rack_response.status.to_s</code> + <code class="ruby"> return @rack_response.status.to_s</code> </li> <li class="never" data-hits="" data-linenumber="86"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="87"> @@ -2257,29 +2299,29 @@ </li> <li class="covered" data-hits="1" data-linenumber="88"> <span class="hits">1</span> - <code class="ruby"> private</code> + <code class="ruby"> private</code> </li> <li class="covered" data-hits="1" data-linenumber="89"> <span class="hits">1</span> - <code class="ruby"> def user_agent</code> + <code class="ruby"> def user_agent</code> </li> <li class="covered" data-hits="12" data-linenumber="90"> <span class="hits">12</span> - <code class="ruby"> Browser.new(:ua =&gt; @rack_request.user_agent, :accept_language =&gt; &#39;en-us&#39;)</code> + <code class="ruby"> Browser.new(:ua =&gt; @rack_request.user_agent, :accept_language =&gt; &#39;en-us&#39;)</code> </li> <li class="never" data-hits="" data-linenumber="91"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="92"> @@ -2287,17 +2329,17 @@ </li> <li class="never" data-hits="" data-linenumber="93"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="94"> - <code class="ruby"> end</code> + <code class="ruby">end</code> </li> <li class="never" data-hits="" data-linenumber="95"> @@ -2707,23 +2749,23 @@ <ol> <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby"> module RedisAnalytics</code> + <code class="ruby">module RedisAnalytics</code> </li> <li class="covered" data-hits="1" data-linenumber="2"> <span class="hits">1</span> - <code class="ruby"> VERSION = &#39;0.7.0&#39;</code> + <code class="ruby"> VERSION = &#39;1.0.0&#39;</code> </li> <li class="never" data-hits="" data-linenumber="3"> - <code class="ruby"> end</code> + <code class="ruby">end</code> </li> <li class="never" data-hits="" data-linenumber="4"> @@ -2749,23 +2791,23 @@ <ol> <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby"> module RedisAnalytics</code> + <code class="ruby">module RedisAnalytics</code> </li> <li class="covered" data-hits="1" data-linenumber="2"> <span class="hits">1</span> - <code class="ruby"> class Visit</code> + <code class="ruby"> class Visit</code> </li> <li class="covered" data-hits="1" data-linenumber="3"> <span class="hits">1</span> - <code class="ruby"> include Metrics</code> + <code class="ruby"> include Metrics</code> </li> <li class="never" data-hits="" data-linenumber="4"> @@ -2773,29 +2815,29 @@ </li> <li class="never" data-hits="" data-linenumber="5"> - <code class="ruby"> # This class represents one unique visit</code> + <code class="ruby"> # This class represents one unique visit</code> </li> <li class="never" data-hits="" data-linenumber="6"> - <code class="ruby"> # User may have never visited the site</code> + <code class="ruby"> # User may have never visited the site</code> </li> <li class="never" data-hits="" data-linenumber="7"> - <code class="ruby"> # User may have visited before but his visit is expired</code> + <code class="ruby"> # User may have visited before but his visit is expired</code> </li> <li class="never" data-hits="" data-linenumber="8"> - <code class="ruby"> # Everything counted here is unique for a visit</code> + <code class="ruby"> # Everything counted here is unique for a visit</code> </li> <li class="never" data-hits="" data-linenumber="9"> @@ -2803,41 +2845,41 @@ </li> <li class="never" data-hits="" data-linenumber="10"> - <code class="ruby"> # helpers</code> + <code class="ruby"> # helpers</code> </li> <li class="covered" data-hits="1" data-linenumber="11"> <span class="hits">1</span> - <code class="ruby"> def for_each_time_range(t)</code> + <code class="ruby"> def for_each_time_range(t)</code> </li> <li class="covered" data-hits="228" data-linenumber="12"> <span class="hits">228</span> - <code class="ruby"> RedisAnalytics.redis_key_timestamps.map{|x, y| t.strftime(x)}.each do |ts|</code> + <code class="ruby"> RedisAnalytics.redis_key_timestamps.map{|x, y| t.strftime(x)}.each do |ts|</code> </li> <li class="covered" data-hits="190" data-linenumber="13"> <span class="hits">190</span> - <code class="ruby"> yield(ts)</code> + <code class="ruby"> yield(ts)</code> </li> <li class="never" data-hits="" data-linenumber="14"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="15"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="16"> @@ -2845,29 +2887,29 @@ </li> <li class="covered" data-hits="1" data-linenumber="17"> <span class="hits">1</span> - <code class="ruby"> def first_visit_info</code> + <code class="ruby"> def first_visit_info</code> </li> <li class="covered" data-hits="12" data-linenumber="18"> <span class="hits">12</span> - <code class="ruby"> cookie = @rack_request.cookies[RedisAnalytics.first_visit_cookie_name]</code> + <code class="ruby"> cookie = @rack_request.cookies[RedisAnalytics.first_visit_cookie_name]</code> </li> <li class="covered" data-hits="12" data-linenumber="19"> <span class="hits">12</span> - <code class="ruby"> return cookie ? cookie.split(&#39;.&#39;) : []</code> + <code class="ruby"> return cookie ? cookie.split(&#39;.&#39;) : []</code> </li> <li class="never" data-hits="" data-linenumber="20"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="21"> @@ -2875,29 +2917,29 @@ </li> <li class="covered" data-hits="1" data-linenumber="22"> <span class="hits">1</span> - <code class="ruby"> def current_visit_info</code> + <code class="ruby"> def current_visit_info</code> </li> <li class="covered" data-hits="19" data-linenumber="23"> <span class="hits">19</span> - <code class="ruby"> cookie = @rack_request.cookies[RedisAnalytics.current_visit_cookie_name]</code> + <code class="ruby"> cookie = @rack_request.cookies[RedisAnalytics.current_visit_cookie_name]</code> </li> <li class="covered" data-hits="19" data-linenumber="24"> <span class="hits">19</span> - <code class="ruby"> return cookie ? cookie.split(&#39;.&#39;) : []</code> + <code class="ruby"> return cookie ? cookie.split(&#39;.&#39;) : []</code> </li> <li class="never" data-hits="" data-linenumber="25"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="26"> @@ -2905,53 +2947,53 @@ </li> <li class="never" data-hits="" data-linenumber="27"> - <code class="ruby"> # method used in analytics.rb to initialize visit</code> + <code class="ruby"> # method used in analytics.rb to initialize visit</code> </li> <li class="covered" data-hits="1" data-linenumber="28"> <span class="hits">1</span> - <code class="ruby"> def initialize(request, response)</code> + <code class="ruby"> def initialize(request, response)</code> </li> <li class="covered" data-hits="4" data-linenumber="29"> <span class="hits">4</span> - <code class="ruby"> @t = Time.now</code> + <code class="ruby"> @t = Time.now</code> </li> <li class="covered" data-hits="4" data-linenumber="30"> <span class="hits">4</span> - <code class="ruby"> @redis_key_prefix = &quot;#{RedisAnalytics.redis_namespace}:&quot;</code> + <code class="ruby"> @redis_key_prefix = &quot;#{RedisAnalytics.redis_namespace}:&quot;</code> </li> <li class="covered" data-hits="4" data-linenumber="31"> <span class="hits">4</span> - <code class="ruby"> @rack_request = request</code> + <code class="ruby"> @rack_request = request</code> </li> <li class="covered" data-hits="4" data-linenumber="32"> <span class="hits">4</span> - <code class="ruby"> @rack_response = response</code> + <code class="ruby"> @rack_response = response</code> </li> <li class="covered" data-hits="4" data-linenumber="33"> <span class="hits">4</span> - <code class="ruby"> @first_visit_seq = first_visit_info[0] || current_visit_info[0]</code> + <code class="ruby"> @first_visit_seq = first_visit_info[0] || current_visit_info[0]</code> </li> <li class="covered" data-hits="4" data-linenumber="34"> <span class="hits">4</span> - <code class="ruby"> @current_visit_seq = current_visit_info[1]</code> + <code class="ruby"> @current_visit_seq = current_visit_info[1]</code> </li> <li class="never" data-hits="" data-linenumber="35"> @@ -2959,17 +3001,17 @@ </li> <li class="covered" data-hits="4" data-linenumber="36"> <span class="hits">4</span> - <code class="ruby"> @first_visit_time = first_visit_info[1]</code> + <code class="ruby"> @first_visit_time = first_visit_info[1]</code> </li> <li class="covered" data-hits="4" data-linenumber="37"> <span class="hits">4</span> - <code class="ruby"> @last_visit_time = first_visit_info[2]</code> + <code class="ruby"> @last_visit_time = first_visit_info[2]</code> </li> <li class="never" data-hits="" data-linenumber="38"> @@ -2977,29 +3019,29 @@ </li> <li class="covered" data-hits="4" data-linenumber="39"> <span class="hits">4</span> - <code class="ruby"> @page_view_seq_no = current_visit_info[2] || 0</code> + <code class="ruby"> @page_view_seq_no = current_visit_info[2] || 0</code> </li> <li class="covered" data-hits="4" data-linenumber="40"> <span class="hits">4</span> - <code class="ruby"> @last_visit_start_time = current_visit_info[3]</code> + <code class="ruby"> @last_visit_start_time = current_visit_info[3]</code> </li> <li class="covered" data-hits="4" data-linenumber="41"> <span class="hits">4</span> - <code class="ruby"> @last_visit_end_time = current_visit_info[4]</code> + <code class="ruby"> @last_visit_end_time = current_visit_info[4]</code> </li> <li class="never" data-hits="" data-linenumber="42"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="43"> @@ -3007,131 +3049,131 @@ </li> <li class="never" data-hits="" data-linenumber="44"> - <code class="ruby"> # called from analytics.rb</code> + <code class="ruby"> # called from analytics.rb</code> </li> <li class="covered" data-hits="1" data-linenumber="45"> <span class="hits">1</span> - <code class="ruby"> def record</code> + <code class="ruby"> def record</code> </li> <li class="covered" data-hits="4" data-linenumber="46"> <span class="hits">4</span> - <code class="ruby"> if @current_visit_seq</code> + <code class="ruby"> if @current_visit_seq</code> </li> <li class="covered" data-hits="1" data-linenumber="47"> <span class="hits">1</span> - <code class="ruby"> track(&quot;visit_time&quot;, @t.to_i - @last_visit_end_time.to_i)</code> + <code class="ruby"> track(&quot;visit_time&quot;, @t.to_i - @last_visit_end_time.to_i)</code> </li> <li class="never" data-hits="" data-linenumber="48"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="covered" data-hits="3" data-linenumber="49"> <span class="hits">3</span> - <code class="ruby"> @current_visit_seq ||= counter(&quot;visits&quot;)</code> + <code class="ruby"> @current_visit_seq ||= counter(&quot;visits&quot;)</code> </li> <li class="covered" data-hits="3" data-linenumber="50"> <span class="hits">3</span> - <code class="ruby"> track(&quot;visits&quot;, 1) # track core &#39;visit&#39; metric</code> + <code class="ruby"> track(&quot;visits&quot;, 1) # track core &#39;visit&#39; metric</code> </li> <li class="covered" data-hits="3" data-linenumber="51"> <span class="hits">3</span> - <code class="ruby"> if @first_visit_seq</code> + <code class="ruby"> if @first_visit_seq</code> </li> <li class="missed" data-hits="0" data-linenumber="52"> - <code class="ruby"> track(&quot;repeat_visits&quot;, 1)</code> + <code class="ruby"> track(&quot;repeat_visits&quot;, 1)</code> </li> <li class="never" data-hits="" data-linenumber="53"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="covered" data-hits="3" data-linenumber="54"> <span class="hits">3</span> - <code class="ruby"> @first_visit_seq ||= counter(&quot;unique_visits&quot;)</code> + <code class="ruby"> @first_visit_seq ||= counter(&quot;unique_visits&quot;)</code> </li> <li class="covered" data-hits="3" data-linenumber="55"> <span class="hits">3</span> - <code class="ruby"> track(&quot;first_visits&quot;, 1)</code> + <code class="ruby"> track(&quot;first_visits&quot;, 1)</code> </li> <li class="covered" data-hits="3" data-linenumber="56"> <span class="hits">3</span> - <code class="ruby"> track(&quot;unique_visits&quot;, 1)</code> + <code class="ruby"> track(&quot;unique_visits&quot;, 1)</code> </li> <li class="never" data-hits="" data-linenumber="57"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="covered" data-hits="3" data-linenumber="58"> <span class="hits">3</span> - <code class="ruby"> exec_custom_methods(&#39;visit&#39;) # custom methods that are measured on a per-visit basis</code> + <code class="ruby"> exec_custom_methods(&#39;visit&#39;) # custom methods that are measured on a per-visit basis</code> </li> <li class="never" data-hits="" data-linenumber="59"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="covered" data-hits="4" data-linenumber="60"> <span class="hits">4</span> - <code class="ruby"> exec_custom_methods(&#39;hit&#39;) # custom methods that are measured on a per-page-view (per-hit) basis</code> + <code class="ruby"> exec_custom_methods(&#39;hit&#39;) # custom methods that are measured on a per-page-view (per-hit) basis</code> </li> <li class="covered" data-hits="4" data-linenumber="61"> <span class="hits">4</span> - <code class="ruby"> track(&quot;page_views&quot;, 1) # track core &#39;page_view&#39; metric</code> + <code class="ruby"> track(&quot;page_views&quot;, 1) # track core &#39;page_view&#39; metric</code> </li> <li class="covered" data-hits="4" data-linenumber="62"> <span class="hits">4</span> - <code class="ruby"> track(&quot;second_page_views&quot;, 1) if @page_view_seq_no.to_i == 1 # @last_visit_start_time and (@last_visit_start_time.to_i == @last_visit_end_time.to_i)</code> + <code class="ruby"> track(&quot;second_page_views&quot;, 1) if @page_view_seq_no.to_i == 1 # @last_visit_start_time and (@last_visit_start_time.to_i == @last_visit_end_time.to_i)</code> </li> <li class="covered" data-hits="4" data-linenumber="63"> <span class="hits">4</span> - <code class="ruby"> @rack_response</code> + <code class="ruby"> @rack_response</code> </li> <li class="never" data-hits="" data-linenumber="64"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="65"> @@ -3139,77 +3181,77 @@ </li> <li class="covered" data-hits="1" data-linenumber="66"> <span class="hits">1</span> - <code class="ruby"> def exec_custom_methods(type)</code> + <code class="ruby"> def exec_custom_methods(type)</code> </li> <li class="covered" data-hits="7" data-linenumber="67"> <span class="hits">7</span> - <code class="ruby"> Metrics.public_instance_methods.each do |meth|</code> + <code class="ruby"> Metrics.public_instance_methods.each do |meth|</code> </li> <li class="covered" data-hits="112" data-linenumber="68"> <span class="hits">112</span> - <code class="ruby"> if m = meth.to_s.match(/^([a-z_]*)_(count|ratio)_per_#{type}$/)</code> + <code class="ruby"> if m = meth.to_s.match(/^([a-z_]*)_(count|ratio)_per_#{type}$/)</code> </li> <li class="covered" data-hits="53" data-linenumber="69"> <span class="hits">53</span> - <code class="ruby"> begin</code> + <code class="ruby"> begin</code> </li> <li class="covered" data-hits="53" data-linenumber="70"> <span class="hits">53</span> - <code class="ruby"> return_value = self.send(meth)</code> + <code class="ruby"> return_value = self.send(meth)</code> </li> <li class="covered" data-hits="53" data-linenumber="71"> <span class="hits">53</span> - <code class="ruby"> track(m.to_a[1], return_value) if return_value</code> + <code class="ruby"> track(m.to_a[1], return_value) if return_value</code> </li> <li class="never" data-hits="" data-linenumber="72"> - <code class="ruby"> rescue =&gt; e</code> + <code class="ruby"> rescue =&gt; e</code> </li> <li class="missed" data-hits="0" data-linenumber="73"> - <code class="ruby"> warn &quot;#{meth} resulted in an exception #{e}&quot;</code> + <code class="ruby"> warn &quot;#{meth} resulted in an exception #{e}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="74"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="75"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="76"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="77"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="78"> @@ -3217,47 +3259,47 @@ </li> <li class="never" data-hits="" data-linenumber="79"> - <code class="ruby"> # helpers</code> + <code class="ruby"> # helpers</code> </li> <li class="covered" data-hits="1" data-linenumber="80"> <span class="hits">1</span> - <code class="ruby"> def counter(metric_name)</code> + <code class="ruby"> def counter(metric_name)</code> </li> <li class="covered" data-hits="6" data-linenumber="81"> <span class="hits">6</span> - <code class="ruby"> n = RedisAnalytics.redis_connection.incr(&quot;#{@redis_key_prefix}#{metric_name}&quot;)</code> + <code class="ruby"> n = RedisAnalytics.redis_connection.incr(&quot;#{@redis_key_prefix}#{metric_name}&quot;)</code> </li> <li class="never" data-hits="" data-linenumber="82"> - <code class="ruby"> # to debug, uncomment this line</code> + <code class="ruby"> # to debug, uncomment this line</code> </li> <li class="never" data-hits="" data-linenumber="83"> - <code class="ruby"> # puts &quot;COUNT #{metric_name} -&gt; #{n}&quot;</code> + <code class="ruby"> # puts &quot;COUNT #{metric_name} -&gt; #{n}&quot;</code> </li> <li class="covered" data-hits="6" data-linenumber="84"> <span class="hits">6</span> - <code class="ruby"> return n</code> + <code class="ruby"> return n</code> </li> <li class="never" data-hits="" data-linenumber="85"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="86"> @@ -3265,47 +3307,47 @@ </li> <li class="covered" data-hits="1" data-linenumber="87"> <span class="hits">1</span> - <code class="ruby"> def updated_current_visit_info</code> + <code class="ruby"> def updated_current_visit_info</code> </li> <li class="covered" data-hits="4" data-linenumber="88"> <span class="hits">4</span> - <code class="ruby"> value = [@first_visit_seq.to_i, @current_visit_seq.to_i, @page_view_seq_no.to_i + 1, (@last_visit_start_time || @t).to_i, @t.to_i]</code> + <code class="ruby"> value = [@first_visit_seq.to_i, @current_visit_seq.to_i, @page_view_seq_no.to_i + 1, (@last_visit_start_time || @t).to_i, @t.to_i]</code> </li> <li class="never" data-hits="" data-linenumber="89"> - <code class="ruby"> # to debug, uncomment this line</code> + <code class="ruby"> # to debug, uncomment this line</code> </li> <li class="never" data-hits="" data-linenumber="90"> - <code class="ruby"> # puts &quot;UPDATING VCN COOKIE -&gt; #{value}&quot;</code> + <code class="ruby"> # puts &quot;UPDATING VCN COOKIE -&gt; #{value}&quot;</code> </li> <li class="covered" data-hits="4" data-linenumber="91"> <span class="hits">4</span> - <code class="ruby"> expires = @t + RedisAnalytics.visit_timeout.to_i.minutes</code> + <code class="ruby"> expires = @t + RedisAnalytics.visit_timeout.to_i.minutes</code> </li> <li class="covered" data-hits="4" data-linenumber="92"> <span class="hits">4</span> - <code class="ruby"> {:value =&gt; value.join(&#39;.&#39;), :expires =&gt; expires}</code> + <code class="ruby"> {:value =&gt; value.join(&#39;.&#39;), :expires =&gt; expires}</code> </li> <li class="never" data-hits="" data-linenumber="93"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="94"> @@ -3313,47 +3355,47 @@ </li> <li class="covered" data-hits="1" data-linenumber="95"> <span class="hits">1</span> - <code class="ruby"> def updated_first_visit_info</code> + <code class="ruby"> def updated_first_visit_info</code> </li> <li class="covered" data-hits="4" data-linenumber="96"> <span class="hits">4</span> - <code class="ruby"> value = [@first_visit_seq.to_i, (@first_visit_time || @t).to_i, @t.to_i]</code> + <code class="ruby"> value = [@first_visit_seq.to_i, (@first_visit_time || @t).to_i, @t.to_i]</code> </li> <li class="never" data-hits="" data-linenumber="97"> - <code class="ruby"> # to debug, uncomment this line</code> + <code class="ruby"> # to debug, uncomment this line</code> </li> <li class="never" data-hits="" data-linenumber="98"> - <code class="ruby"> # puts &quot;UPDATING RUCN COOKIE -&gt; #{value}&quot;</code> + <code class="ruby"> # puts &quot;UPDATING RUCN COOKIE -&gt; #{value}&quot;</code> </li> <li class="covered" data-hits="4" data-linenumber="99"> <span class="hits">4</span> - <code class="ruby"> expires = @t + 1.year</code> + <code class="ruby"> expires = @t + 1.year</code> </li> <li class="covered" data-hits="4" data-linenumber="100"> <span class="hits">4</span> - <code class="ruby"> {:value =&gt; value.join(&#39;.&#39;), :expires =&gt; expires}</code> + <code class="ruby"> {:value =&gt; value.join(&#39;.&#39;), :expires =&gt; expires}</code> </li> <li class="never" data-hits="" data-linenumber="101"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="102"> @@ -3361,95 +3403,95 @@ </li> <li class="covered" data-hits="1" data-linenumber="103"> <span class="hits">1</span> - <code class="ruby"> def track(metric_name, metric_value)</code> + <code class="ruby"> def track(metric_name, metric_value)</code> </li> <li class="covered" data-hits="38" data-linenumber="104"> <span class="hits">38</span> - <code class="ruby"> n = 0</code> + <code class="ruby"> n = 0</code> </li> <li class="covered" data-hits="38" data-linenumber="105"> <span class="hits">38</span> - <code class="ruby"> RedisAnalytics.redis_connection.hmset(&quot;#{@redis_key_prefix}#METRICS&quot;, metric_name, metric_value.class)</code> + <code class="ruby"> RedisAnalytics.redis_connection.hmset(&quot;#{@redis_key_prefix}#METRICS&quot;, metric_name, metric_value.class)</code> </li> <li class="covered" data-hits="38" data-linenumber="106"> <span class="hits">38</span> - <code class="ruby"> for_each_time_range(@t) do |ts|</code> + <code class="ruby"> for_each_time_range(@t) do |ts|</code> </li> <li class="covered" data-hits="190" data-linenumber="107"> <span class="hits">190</span> - <code class="ruby"> key = &quot;#{@redis_key_prefix}#{metric_name}:#{ts}&quot;</code> + <code class="ruby"> key = &quot;#{@redis_key_prefix}#{metric_name}:#{ts}&quot;</code> </li> <li class="covered" data-hits="190" data-linenumber="108"> <span class="hits">190</span> - <code class="ruby"> if metric_value.is_a?(Fixnum)</code> + <code class="ruby"> if metric_value.is_a?(Fixnum)</code> </li> <li class="covered" data-hits="75" data-linenumber="109"> <span class="hits">75</span> - <code class="ruby"> n = RedisAnalytics.redis_connection.incrby(key, metric_value)</code> + <code class="ruby"> n = RedisAnalytics.redis_connection.incrby(key, metric_value)</code> </li> <li class="never" data-hits="" data-linenumber="110"> - <code class="ruby"> else</code> + <code class="ruby"> else</code> </li> <li class="covered" data-hits="115" data-linenumber="111"> <span class="hits">115</span> - <code class="ruby"> n = RedisAnalytics.redis_connection.zincrby(key, 1, metric_value)</code> + <code class="ruby"> n = RedisAnalytics.redis_connection.zincrby(key, 1, metric_value)</code> </li> <li class="never" data-hits="" data-linenumber="112"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="113"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="114"> - <code class="ruby"> # to debug, uncomment this line</code> + <code class="ruby"> # to debug, uncomment this line</code> </li> <li class="never" data-hits="" data-linenumber="115"> - <code class="ruby"> # puts &quot;TRACK #{metric_name} -&gt; #{n}&quot; </code> + <code class="ruby"> # puts &quot;TRACK #{metric_name} -&gt; #{n}&quot; </code> </li> <li class="covered" data-hits="38" data-linenumber="116"> <span class="hits">38</span> - <code class="ruby"> return n</code> + <code class="ruby"> return n</code> </li> <li class="never" data-hits="" data-linenumber="117"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="118"> @@ -3457,16 +3499,16 @@ </li> <li class="never" data-hits="" data-linenumber="119"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="120"> - <code class="ruby"> end</code> + <code class="ruby">end</code> </li> <li class="never" data-hits="" data-linenumber="121">