| updated documentation - reportable - Fork of reportable required by WarVox, fro… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 1166ac66c5e5c75af0ca808ffc5b43e3deaeef6b | |
| parent 0d6bd917f144d7985057e52b89da00aa42b5603b | |
| Author: Marco Otte-Witte <[email protected]> | |
| Date: Wed, 29 Apr 2009 19:34:12 +0200 | |
| updated documentation | |
| Diffstat: | |
| M README.rdoc | 48 ++++++++++++++---------------… | |
| M doc/classes/Simplabs/ReportsAsSpar… | 79 ++++++++++++++++-----------… | |
| M doc/classes/Simplabs/ReportsAsSpar… | 21 +++++++++++++-------- | |
| D doc/classes/Simplabs/ReportsAsSpar… | 192 ---------------------------… | |
| M doc/classes/Simplabs/ReportsAsSpar… | 91 ++++++++++++++++-----------… | |
| A doc/classes/Simplabs/ReportsAsSpar… | 124 +++++++++++++++++++++++++++… | |
| D doc/classes/Simplabs/ReportsAsSpar… | 327 ---------------------------… | |
| M doc/classes/Simplabs/ReportsAsSpar… | 12 +++++++----- | |
| M doc/coverage/index.html | 14 +++++++------- | |
| M doc/coverage/lib-simplabs-reports_… | 92 ++++++++++++++++-----------… | |
| M doc/coverage/lib-simplabs-reports_… | 238 +++++++++++++++------------… | |
| M doc/coverage/lib-simplabs-reports_… | 202 ++++++++++++++++-----------… | |
| M doc/coverage/lib-simplabs-reports_… | 240 ++++++++++++++++-----------… | |
| M doc/coverage/lib-simplabs-reports_… | 207 ++++++++++++++-------------… | |
| M doc/coverage/lib-simplabs-reports_… | 8 ++++---- | |
| M doc/coverage/lib-simplabs-reports_… | 75 ++++++++++++++++-----------… | |
| M doc/created.rid | 2 +- | |
| M doc/files/README_rdoc.html | 101 ++++++++++++++++-------------… | |
| M doc/files/lib/simplabs/reports_as_… | 2 +- | |
| M doc/files/lib/simplabs/reports_as_… | 2 +- | |
| M doc/files/lib/simplabs/reports_as_… | 2 +- | |
| M doc/files/lib/simplabs/reports_as_… | 2 +- | |
| M doc/files/lib/simplabs/reports_as_… | 2 +- | |
| M doc/files/lib/simplabs/reports_as_… | 2 +- | |
| M doc/files/lib/simplabs/reports_as_… | 2 +- | |
| M doc/fr_class_index.html | 3 +-- | |
| M doc/fr_method_index.html | 11 ++--------- | |
| M doc/spec.html | 2 +- | |
| M lib/simplabs/reports_as_sparkline.… | 21 +++++++++++---------- | |
| M lib/simplabs/reports_as_sparkline/… | 8 ++++---- | |
| M lib/simplabs/reports_as_sparkline/… | 8 ++------ | |
| M lib/simplabs/reports_as_sparkline/… | 26 +++++++++++++------------- | |
| M lib/simplabs/reports_as_sparkline/… | 6 ++++-- | |
| M lib/simplabs/reports_as_sparkline/… | 25 +++++-------------------- | |
| M lib/simplabs/reports_as_sparkline/… | 6 +++--- | |
| 35 files changed, 891 insertions(+), 1312 deletions(-) | |
| --- | |
| diff --git a/README.rdoc b/README.rdoc | |
| @@ -1,21 +1,20 @@ | |
| = ReportsAsSparkline | |
| -ReportsAsSparkline enables you to generate reports and sparklines from your mo… | |
| +ReportsAsSparkline enables you to generate sparkline reports from your model's… | |
| == Usage | |
| If you hace a +User+ model with +created_at+ and +activated_at+ columns, you c… | |
| to it with the following options: | |
| -* :date_column - The name of the date column on that the records are aggregated | |
| -* :value_column - The name of the column that holds the value to sum for aggre… | |
| -* :aggregation - The aggregation to use (one of :count, :sum, :minimum, :maxim… | |
| -* :grouping - The period records are grouped on (:hour, :day, :week, :month); … | |
| -* :limit - The number of periods to get (see :grouping) | |
| -* :conditions - Conditions like in ActiveRecord::Base#find; only records that … | |
| -* :cumulate - Sets whether to cumulate the numbers (instead of [1, 2, 3] retur… | |
| -* :live_data - Specified whether data for the current reporting period is read… | |
| -* :end_date - When specified, the report will only include data for the period… | |
| +* <tt>:date_column</tt> - The name of the date column over that the records ar… | |
| +* <tt>:value_column</tt> - The name of the column that holds the values to sum… | |
| +* <tt>:aggregation</tt> - The aggregation to use (one of <tt>:count</tt>, <tt>… | |
| +* <tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, <tt>… | |
| +* <tt>:limit</tt> - The number of reporting periods to get (see <tt>:grouping<… | |
| +* <tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; … | |
| +* <tt>:live_data</tt> - Specifies whether data for the current reporting perio… | |
| +* <tt>:end_date</tt> - When specified, the report will only include data for t… | |
| <b>Example:</b> | |
| @@ -33,30 +32,28 @@ This will add the following class methods to your User mode… | |
| When invoking the report, you can override some of the options you specified f… | |
| -* :grouping - The period records are grouped on (:hour, :day, :week, :month) | |
| -* :limit - The number of periods to get (see :grouping) | |
| -* :conditions - Conditions like in ActiveRecord::Base#find; only records that … | |
| -* :live_data - Specified whether data for the current reporting period is read… | |
| -* :end_date - When specified, the report will be for the periods before this d… | |
| +* <tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, <tt>… | |
| +* <tt>:limit</tt> - The number of reporting periods to get (see <tt>:grouping<… | |
| +* <tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; … | |
| +* <tt>:live_data</tt> - Specifies whether data for the current reporting perio… | |
| +* <tt>:end_date</tt> - When specified, the report will only include data for t… | |
| <b>Example:</b> | |
| User.registrations_report(:conditions => ['last_name LIKE 'A%']) | |
| User.activations_report(:grouping => :week, :limit => 5) | |
| -<b>Beware that when specifying conditions on invocation of the report, the cac… | |
| - | |
| You can than render sparklines for these reports with sparkline_tag in your vi… | |
| <%= sparkline_tag(User.registrations_report) %> | |
| The +sparkline_tag+ helper takes the following parameters: | |
| -* width - The width of the generated image | |
| -* height - The height of the generated image | |
| -* line_color - The line color of the sparkline (hex code) | |
| -* fill_color - The color to fill the area below the sparkline with (hex code) | |
| -* labes - The axes to render lables for (Array of :x, :y, :r, :t; this is x ax… | |
| +* <tt>width</tt> - The width of the generated image | |
| +* <tt>height</tt> - The height of the generated image | |
| +* <tt>line_color</tt> - The line color of the sparkline (hex code) | |
| +* <tt>fill_color</tt> - The color to fill the area below the sparkline with (h… | |
| +* <tt>labels</tt> - The axes to render lables for (Array of <tt>:x</tt>, <tt>:… | |
| == Installation | |
| @@ -64,11 +61,11 @@ Installation requires 3 simple steps: | |
| <b>get the plugin</b> | |
| -From your RAILS_ROOT in Rails >= 2.1, do | |
| +From your RAILS_ROOT in Rails >= 2.1, do | |
| ./script/plugin install git://github.com/marcoow/reports_as_sparkline.git | |
| -If you are on Rails < 2.1, do this from your RAILS_ROOT | |
| +If you are on Rails < 2.1, do this from your RAILS_ROOT | |
| git clone git://github.com/marcoow/reports_as_sparkline.git vendor/plugins/r… | |
| @@ -97,7 +94,6 @@ If you are on PostgreSQL, you should add functional indices: | |
| == TODOs/ future plans | |
| * support for Oracle and DB2 (and others?) missing | |
| -* Implement data ranges in arguments | |
| * Limit number of data points to maximum that the google chart api allows | |
| * Make graph styling configurable | |
| @@ -109,4 +105,4 @@ If you want to suggest any new features or report bugs, do … | |
| == Author | |
| -© 2008-2009 Marco Otte-Witte (http://simplabs.com/#projects), Martin Kavalar,… | |
| +© 2008-2009 Marco Otte-Witte (http://simplabs.com), Martin Kavalar, released … | |
| diff --git a/doc/classes/Simplabs/ReportsAsSparkline/ClassMethods.html b/doc/cl… | |
| @@ -114,53 +114,57 @@ | |
| <div class="method-description"> | |
| <p> | |
| Generates a report on a model. That report can then be executed via the new | |
| -method <name>_report (see documentation of <a | |
| -href="Report.html#M000014">Simplabs::ReportsAsSparkline::Report#run</a>). | |
| +method <tt><name>_report</tt> (see documentation of <a | |
| +href="Report.html#M000007">Simplabs::ReportsAsSparkline::Report#run</a>). | |
| </p> | |
| <h4>Parameters</h4> | |
| <ul> | |
| <li><tt>name</tt> - The name of the report, defines the name of the generated | |
| -report method (<name>_report) | |
| +report method (<tt><name>_report</tt>) | |
| </li> | |
| </ul> | |
| <h4>Options</h4> | |
| <ul> | |
| -<li><tt>:date_column</tt> - The name of the date column on that the records are | |
| -aggregated | |
| +<li><tt>:date_column</tt> - The name of the date column over that the records | |
| +are aggregated (defaults to <tt>created_at</tt>) | |
| </li> | |
| -<li><tt>:value_column</tt> - The name of the column that holds the value to sum | |
| -for aggregation :sum | |
| +<li><tt>:value_column</tt> - The name of the column that holds the values to | |
| +sum up when using aggregation <tt>:sum</tt> | |
| </li> | |
| -<li><tt>:aggregation</tt> - The aggregation to use (one of :count, :sum, | |
| -:minimum, :maximum or :average); when using anything other than :count, | |
| -:value_column must also be specified (<b>If you really want to e.g. sumon | |
| -the ‘id’ column, you have to explicitely say so.</b>) | |
| +<li><tt>:aggregation</tt> - The aggregation to use (one of <tt>:count</tt>, | |
| +<tt>:sum</tt>, <tt>:minimum</tt>, <tt>:maximum</tt> or <tt>:average</tt>); | |
| +when using anything other than <tt>:count</tt>, <tt>:value_column</tt> must | |
| +also be specified (<b>If you really want to e.g. sum up the values in the | |
| +<tt>id</tt> column, you have to explicitely say so.</b>); (defaults to | |
| +<tt>:count</tt>) | |
| </li> | |
| -<li><tt>:grouping</tt> - The period records are grouped on (:hour, :day, :week, | |
| -:month); <b>Beware that <a | |
| -href="ClassMethods.html#M000002">reports_as_sparkline</a> treats weeks as | |
| -starting on monday!</b> | |
| +<li><tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, | |
| +<tt>:day</tt>, <tt>:week</tt>, <tt>:month</tt>); <b>Beware that <tt><a | |
| +href="ClassMethods.html#M000002">reports_as_sparkline</a></tt> treats weeks | |
| +as starting on monday!</b> | |
| </li> | |
| -<li><tt>:limit</tt> - The number of periods to get (see :grouping) | |
| +<li><tt>:limit</tt> - The number of reporting periods to get (see | |
| +<tt>:grouping</tt>), (defaults to 100) | |
| </li> | |
| -<li><tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; only | |
| -records that match there conditions are reported on | |
| +<li><tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; | |
| +only records that match the conditions are reported; <b>Beware that when | |
| +conditions are specified, caching is disabled!</b> | |
| </li> | |
| -<li><tt>:live_data</tt> - Specified whether data for the current reporting | |
| -period is read; if :live_data is true, you will experience a performance | |
| -hit since the request cannot be satisfied from the cache only (defaults to | |
| -false) | |
| +<li><tt>:live_data</tt> - Specifies whether data for the current reporting | |
| +period is to be read; <b>if <tt>:live_data</tt> is <tt>true</tt>, you will | |
| +experience a performance hit since the request cannot be satisfied from the | |
| +cache only (defaults to <tt>false</tt>)</b> | |
| </li> | |
| <li><tt>:end_date</tt> - When specified, the report will only include data for | |
| -the periods before this date. | |
| +the <tt>:limit</tt> reporting periods until this date. | |
| </li> | |
| </ul> | |
| @@ -170,6 +174,7 @@ the periods before this date. | |
| reports_as_sparkline :games_per_day | |
| reports_as_sparkline :games_played_total, :cumulate => true | |
| end | |
| + | |
| class User < ActiveRecord::Base | |
| reports_as_sparkline :registrations, :aggregation => :count | |
| reports_as_sparkline :activations, :aggregation => :count, :date_colum… | |
| @@ -181,20 +186,20 @@ the periods before this date. | |
| onclick="toggleCode('M000002-source');return false;">[Source]</a><… | |
| <div class="method-source-code" id="M000002-source"> | |
| <pre> | |
| - <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline.rb… | |
| -40: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| -41: (<span class="ruby-keyword kw">class</span> <span class="ruby-oper… | |
| -42: <span class="ruby-identifier">define_method</span> <span class="… | |
| -43: <span class="ruby-keyword kw">if</span> <span class="ruby-iden… | |
| -44: <span class="ruby-identifier">report</span> = <span class="r… | |
| -45: <span class="ruby-keyword kw">else</span> | |
| -46: <span class="ruby-identifier">report</span> = <span class="r… | |
| -47: <span class="ruby-keyword kw">end</span> | |
| -48: <span class="ruby-identifier">raise</span> <span class="ruby-c… | |
| -49: <span class="ruby-identifier">report</span>.<span class="ruby-… | |
| -50: <span class="ruby-keyword kw">end</span> | |
| -51: <span class="ruby-keyword kw">end</span> | |
| -52: <span class="ruby-keyword kw">end</span> | |
| + <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline.rb… | |
| +41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| +42: (<span class="ruby-keyword kw">class</span> <span class="ruby-oper… | |
| +43: <span class="ruby-identifier">define_method</span> <span class="… | |
| +44: <span class="ruby-keyword kw">if</span> <span class="ruby-iden… | |
| +45: <span class="ruby-identifier">report</span> = <span class="r… | |
| +46: <span class="ruby-keyword kw">else</span> | |
| +47: <span class="ruby-identifier">report</span> = <span class="r… | |
| +48: <span class="ruby-keyword kw">end</span> | |
| +49: <span class="ruby-identifier">raise</span> <span class="ruby-c… | |
| +50: <span class="ruby-identifier">report</span>.<span class="ruby-… | |
| +51: <span class="ruby-keyword kw">end</span> | |
| +52: <span class="ruby-keyword kw">end</span> | |
| +53: <span class="ruby-keyword kw">end</span> | |
| </pre> | |
| </div> | |
| </div> | |
| diff --git a/doc/classes/Simplabs/ReportsAsSparkline/CumulatedReport.html b/doc… | |
| @@ -86,14 +86,19 @@ A special report class that cumulates all data (see <a | |
| href="Report.html">Simplabs::ReportsAsSparkline::Report</a>) | |
| </p> | |
| <h4>Examples</h4> | |
| +<p> | |
| +When <a href="Report.html">Simplabs::ReportsAsSparkline::Report</a> returns | |
| +</p> | |
| <pre> | |
| - When Simplabs::ReportsAsSparkline::Report returns | |
| - | |
| - [[<DateTime today>, 1], [<DateTime yesterday>, 2], etc.] | |
| - | |
| - Simplabs::ReportsAsSparkline::CumulatedReport returns | |
| - | |
| - [[<DateTime today>, 3], [<DateTime yesterday>, 2], etc.] | |
| + [[<DateTime today>, 1], [<DateTime yesterday>, 2], etc.] | |
| +</pre> | |
| +<p> | |
| +<a | |
| +href="CumulatedReport.html">Simplabs::ReportsAsSparkline::CumulatedReport</a> | |
| +returns | |
| +</p> | |
| +<pre> | |
| + [[<DateTime today>, 3], [<DateTime yesterday>, 2], etc.] | |
| </pre> | |
| </div> | |
| @@ -141,7 +146,7 @@ href="Report.html">Simplabs::ReportsAsSparkline::Report</a>) | |
| <div class="method-description"> | |
| <p> | |
| Runs the report (see <a | |
| -href="Report.html#M000014">Simplabs::ReportsAsSparkline::Report#run</a>) | |
| +href="Report.html#M000007">Simplabs::ReportsAsSparkline::Report#run</a>) | |
| </p> | |
| <p><a class="source-toggle" href="#" | |
| onclick="toggleCode('M000003-source');return false;">[Source]</a><… | |
| diff --git a/doc/classes/Simplabs/ReportsAsSparkline/Grouping.html b/doc/classe… | |
| @@ -1,191 +0,0 @@ | |
| -<?xml version="1.0" encoding="iso-8859-1"?> | |
| -<!DOCTYPE html | |
| - PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
| - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| - | |
| -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
| -<head> | |
| - <title>Class: Simplabs::ReportsAsSparkline::Grouping</title> | |
| - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
| - <meta http-equiv="Content-Script-Type" content="text/javascript" /> | |
| - <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" medi… | |
| - <script type="text/javascript"> | |
| - // <![CDATA[ | |
| - | |
| - function popupCode( url ) { | |
| - window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=n… | |
| - } | |
| - | |
| - function toggleCode( id ) { | |
| - if ( document.getElementById ) | |
| - elem = document.getElementById( id ); | |
| - else if ( document.all ) | |
| - elem = eval( "document.all." + id ); | |
| - else | |
| - return false; | |
| - | |
| - elemStyle = elem.style; | |
| - | |
| - if ( elemStyle.display != "block" ) { | |
| - elemStyle.display = "block" | |
| - } else { | |
| - elemStyle.display = "none" | |
| - } | |
| - | |
| - return true; | |
| - } | |
| - | |
| - // Make codeblocks hidden by default | |
| - document.writeln( "<style type=\"text/css\">div.method-source-code { display… | |
| - | |
| - // ]]> | |
| - </script> | |
| - | |
| -</head> | |
| -<body> | |
| - | |
| - | |
| - | |
| - <div id="classHeader"> | |
| - <table class="header-table"> | |
| - <tr class="top-aligned-row"> | |
| - <td><strong>Class</strong></td> | |
| - <td class="class-name-in-header">Simplabs::ReportsAsSparkline::Group… | |
| - </tr> | |
| - <tr class="top-aligned-row"> | |
| - <td><strong>In:</strong></td> | |
| - <td> | |
| - <a href="../../../files/lib/simplabs/reports_as_sparkline/grou… | |
| - lib/simplabs/reports_as_sparkline/grouping.rb | |
| - </a> | |
| - <br /> | |
| - </td> | |
| - </tr> | |
| - | |
| - <tr class="top-aligned-row"> | |
| - <td><strong>Parent:</strong></td> | |
| - <td> | |
| - Object | |
| - </td> | |
| - </tr> | |
| - </table> | |
| - </div> | |
| - <!-- banner header --> | |
| - | |
| - <div id="bodyContent"> | |
| - | |
| - | |
| - | |
| - <div id="contextContent"> | |
| - | |
| - <div id="description"> | |
| - <p> | |
| -This is the grouping a report uses to group records in the database | |
| -</p> | |
| - | |
| - </div> | |
| - | |
| - | |
| - </div> | |
| - | |
| - <div id="method-list"> | |
| - <h3 class="section-bar">Methods</h3> | |
| - | |
| - <div class="name-list"> | |
| - <a href="#M000007">identifier</a> | |
| - <a href="#M000006">new</a> | |
| - </div> | |
| - </div> | |
| - | |
| - </div> | |
| - | |
| - | |
| - <!-- if includes --> | |
| - | |
| - <div id="section"> | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - <!-- if method_list --> | |
| - <div id="methods"> | |
| - <h3 class="section-bar">Public Class methods</h3> | |
| - | |
| - <div id="method-M000006" class="method-detail"> | |
| - <a name="M000006"></a> | |
| - | |
| - <div class="method-heading"> | |
| - <a href="#M000006" class="method-signature"> | |
| - <span class="method-name">new</span><span class="method-args">(ident… | |
| - </a> | |
| - </div> | |
| - | |
| - <div class="method-description"> | |
| - <h4>Parameters</h4> | |
| -<ul> | |
| -<li><tt><a href="Grouping.html#M000007">identifier</a></tt> - The <a | |
| -href="Grouping.html#M000007">identifier</a> of the grouping - one of :hour, | |
| -:day, :week or :month | |
| - | |
| -</li> | |
| -</ul> | |
| - <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000006-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000006-source"> | |
| -<pre> | |
| - <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/gr… | |
| -10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| -11: <span class="ruby-identifier">raise</span> <span class="ruby-const… | |
| -12: <span class="ruby-ivar">@identifier</span> = <span class="ruby-ide… | |
| -13: <span class="ruby-keyword kw">end</span> | |
| -</pre> | |
| - </div> | |
| - </div> | |
| - </div> | |
| - | |
| - <h3 class="section-bar">Public Instance methods</h3> | |
| - | |
| - <div id="method-M000007" class="method-detail"> | |
| - <a name="M000007"></a> | |
| - | |
| - <div class="method-heading"> | |
| - <a href="#M000007" class="method-signature"> | |
| - <span class="method-name">identifier</span><span class="method-args"… | |
| - </a> | |
| - </div> | |
| - | |
| - <div class="method-description"> | |
| - <p> | |
| -Returns the <a href="Grouping.html">Grouping</a>‘s <a | |
| -href="Grouping.html#M000007">identifier</a> | |
| -</p> | |
| - <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000007-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000007-source"> | |
| -<pre> | |
| - <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/gr… | |
| -16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| -17: <span class="ruby-ivar">@identifier</span> | |
| -18: <span class="ruby-keyword kw">end</span> | |
| -</pre> | |
| - </div> | |
| - </div> | |
| - </div> | |
| - | |
| - | |
| - </div> | |
| - | |
| - | |
| - </div> | |
| - | |
| - | |
| -<div id="validator-badges"> | |
| - <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></sm… | |
| -</div> | |
| - | |
| -</body> | |
| -</html> | |
| -\ No newline at end of file | |
| diff --git a/doc/classes/Simplabs/ReportsAsSparkline/Report.html b/doc/classes/… | |
| @@ -93,8 +93,8 @@ and calculations | |
| <h3 class="section-bar">Methods</h3> | |
| <div class="name-list"> | |
| - <a href="#M000013">new</a> | |
| - <a href="#M000014">run</a> | |
| + <a href="#M000006">new</a> | |
| + <a href="#M000007">run</a> | |
| </div> | |
| </div> | |
| @@ -154,11 +154,11 @@ and calculations | |
| <div id="methods"> | |
| <h3 class="section-bar">Public Class methods</h3> | |
| - <div id="method-M000013" class="method-detail"> | |
| - <a name="M000013"></a> | |
| + <div id="method-M000006" class="method-detail"> | |
| + <a name="M000006"></a> | |
| <div class="method-heading"> | |
| - <a href="#M000013" class="method-signature"> | |
| + <a href="#M000006" class="method-signature"> | |
| <span class="method-name">new</span><span class="method-args">(klass… | |
| </a> | |
| </div> | |
| @@ -179,46 +179,50 @@ href="ClassMethods.html#M000002">Simplabs::ReportsAsSpark… | |
| </ul> | |
| <h4>Options</h4> | |
| <ul> | |
| -<li><tt>:date_column</tt> - The name of the date column on that the records are | |
| -aggregated | |
| +<li><tt>:date_column</tt> - The name of the date column over that the records | |
| +are aggregated (defaults to <tt>created_at</tt>) | |
| </li> | |
| -<li><tt>:value_column</tt> - The name of the column that holds the value to sum | |
| -for aggregation :sum | |
| +<li><tt>:value_column</tt> - The name of the column that holds the values to | |
| +sum up when using aggregation <tt>:sum</tt> | |
| </li> | |
| -<li><tt>:aggregation</tt> - The aggregation to use (one of :count, :sum, | |
| -:minimum, :maximum or :average); when using anything other than :count, | |
| -:value_column must also be specified (<b>If you really want to e.g. sumon | |
| -the ‘id’ column, you have to explicitely say so.</b>) | |
| +<li><tt>:aggregation</tt> - The aggregation to use (one of <tt>:count</tt>, | |
| +<tt>:sum</tt>, <tt>:minimum</tt>, <tt>:maximum</tt> or <tt>:average</tt>); | |
| +when using anything other than <tt>:count</tt>, <tt>:value_column</tt> must | |
| +also be specified (<b>If you really want to e.g. sum up the values in the | |
| +<tt>id</tt> column, you have to explicitely say so.</b>); (defaults to | |
| +<tt>:count</tt>) | |
| </li> | |
| -<li><tt>:grouping</tt> - The period records are grouped on (:hour, :day, :week, | |
| -:month); <b>Beware that reports_as_sparkline treats weeks as starting on | |
| -monday!</b> | |
| +<li><tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, | |
| +<tt>:day</tt>, <tt>:week</tt>, <tt>:month</tt>); <b>Beware that | |
| +<tt>reports_as_sparkline</tt> treats weeks as starting on monday!</b> | |
| </li> | |
| -<li><tt>:limit</tt> - The number of periods to get (see :grouping) | |
| +<li><tt>:limit</tt> - The number of reporting periods to get (see | |
| +<tt>:grouping</tt>), (defaults to 100) | |
| </li> | |
| -<li><tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; only | |
| -records that match there conditions are reported on | |
| +<li><tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; | |
| +only records that match the conditions are reported; <b>Beware that when | |
| +conditions are specified, caching is disabled!</b> | |
| </li> | |
| -<li><tt>:live_data</tt> - Specified whether data for the current reporting | |
| -period is read; if :live_data is true, you will experience a performance | |
| -hit since the request cannot be satisfied from the cache only (defaults to | |
| -false) | |
| +<li><tt>:live_data</tt> - Specifies whether data for the current reporting | |
| +period is to be read; <b>if <tt>:live_data</tt> is <tt>true</tt>, you will | |
| +experience a performance hit since the request cannot be satisfied from the | |
| +cache only (defaults to <tt>false</tt>)</b> | |
| </li> | |
| <li><tt>:end_date</tt> - When specified, the report will only include data for | |
| -the periods before this date. | |
| +the <tt>:limit</tt> reporting periods until this date. | |
| </li> | |
| </ul> | |
| <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000013-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000013-source"> | |
| + onclick="toggleCode('M000006-source');return false;">[Source]</a><… | |
| + <div class="method-source-code" id="M000006-source"> | |
| <pre> | |
| <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/re… | |
| 24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| @@ -245,11 +249,11 @@ the periods before this date. | |
| <h3 class="section-bar">Public Instance methods</h3> | |
| - <div id="method-M000014" class="method-detail"> | |
| - <a name="M000014"></a> | |
| + <div id="method-M000007" class="method-detail"> | |
| + <a name="M000007"></a> | |
| <div class="method-heading"> | |
| - <a href="#M000014" class="method-signature"> | |
| + <a href="#M000007" class="method-signature"> | |
| <span class="method-name">run</span><span class="method-args">(optio… | |
| </a> | |
| </div> | |
| @@ -260,33 +264,34 @@ Runs the report and returns an array of array of DateTime… | |
| </p> | |
| <h4>Options</h4> | |
| <ul> | |
| -<li><tt>:limit</tt> - The number of periods to get | |
| +<li><tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, | |
| +<tt>:day</tt>, <tt>:week</tt>, <tt>:month</tt>); <b>Beware that | |
| +<tt>reports_as_sparkline</tt> treats weeks as starting on monday!</b> | |
| </li> | |
| -<li><tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; only | |
| -records that match there conditions are reported on (<b>Beware that when | |
| -you specify conditions here, caching will be disabled</b>) | |
| +<li><tt>:limit</tt> - The number of reporting periods to get (see | |
| +<tt>:grouping</tt>), (defaults to 100) | |
| </li> | |
| -<li><tt>:grouping</tt> - The period records are grouped on (:hour, :day, :week, | |
| -:month); <b>Beware that reports_as_sparkline treats weeks as starting on | |
| -monday!</b> | |
| +<li><tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; | |
| +only records that match the conditions are reported; <b>Beware that when | |
| +conditions are specified, caching is disabled!</b> | |
| </li> | |
| -<li><tt>:live_data</tt> - Specified whether data for the current reporting | |
| -period is read; if :live_data is true, you will experience a performance | |
| -hit since the request cannot be satisfied from the cache only (defaults to | |
| -false) | |
| +<li><tt>:live_data</tt> - Specifies whether data for the current reporting | |
| +period is to be read; <b>if <tt>:live_data</tt> is <tt>true</tt>, you will | |
| +experience a performance hit since the request cannot be satisfied from the | |
| +cache only (defaults to <tt>false</tt>)</b> | |
| </li> | |
| <li><tt>:end_date</tt> - When specified, the report will only include data for | |
| -the periods before this date. | |
| +the <tt>:limit</tt> reporting periods until this date. | |
| </li> | |
| </ul> | |
| <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000014-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000014-source"> | |
| + onclick="toggleCode('M000007-source');return false;">[Source]</a><… | |
| + <div class="method-source-code" id="M000007-source"> | |
| <pre> | |
| <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/re… | |
| 50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| diff --git a/doc/classes/Simplabs/ReportsAsSparkline/ReportCache.html b/doc/cla… | |
| @@ -0,0 +1,123 @@ | |
| +<?xml version="1.0" encoding="iso-8859-1"?> | |
| +<!DOCTYPE html | |
| + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
| + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| + | |
| +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
| +<head> | |
| + <title>Class: Simplabs::ReportsAsSparkline::ReportCache</title> | |
| + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
| + <meta http-equiv="Content-Script-Type" content="text/javascript" /> | |
| + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" medi… | |
| + <script type="text/javascript"> | |
| + // <![CDATA[ | |
| + | |
| + function popupCode( url ) { | |
| + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=n… | |
| + } | |
| + | |
| + function toggleCode( id ) { | |
| + if ( document.getElementById ) | |
| + elem = document.getElementById( id ); | |
| + else if ( document.all ) | |
| + elem = eval( "document.all." + id ); | |
| + else | |
| + return false; | |
| + | |
| + elemStyle = elem.style; | |
| + | |
| + if ( elemStyle.display != "block" ) { | |
| + elemStyle.display = "block" | |
| + } else { | |
| + elemStyle.display = "none" | |
| + } | |
| + | |
| + return true; | |
| + } | |
| + | |
| + // Make codeblocks hidden by default | |
| + document.writeln( "<style type=\"text/css\">div.method-source-code { display… | |
| + | |
| + // ]]> | |
| + </script> | |
| + | |
| +</head> | |
| +<body> | |
| + | |
| + | |
| + | |
| + <div id="classHeader"> | |
| + <table class="header-table"> | |
| + <tr class="top-aligned-row"> | |
| + <td><strong>Class</strong></td> | |
| + <td class="class-name-in-header">Simplabs::ReportsAsSparkline::Repor… | |
| + </tr> | |
| + <tr class="top-aligned-row"> | |
| + <td><strong>In:</strong></td> | |
| + <td> | |
| + <a href="../../../files/lib/simplabs/reports_as_sparkline/repo… | |
| + lib/simplabs/reports_as_sparkline/report_cache.rb | |
| + </a> | |
| + <br /> | |
| + </td> | |
| + </tr> | |
| + | |
| + <tr class="top-aligned-row"> | |
| + <td><strong>Parent:</strong></td> | |
| + <td> | |
| + ActiveRecord::Base | |
| + </td> | |
| + </tr> | |
| + </table> | |
| + </div> | |
| + <!-- banner header --> | |
| + | |
| + <div id="bodyContent"> | |
| + | |
| + | |
| + | |
| + <div id="contextContent"> | |
| + | |
| + <div id="description"> | |
| + <p> | |
| +The <a href="ReportCache.html">ReportCache</a> class is a regular | |
| +<tt>ActiveRecord</tt> model and represents cached results for single | |
| +reporting periods (table name is <tt>reports_as_sparkline_cache</tt>) <a | |
| +href="ReportCache.html">ReportCache</a> instances are identified by the | |
| +combination of <tt>model_name</tt>, <tt>report_name</tt>, | |
| +<tt>grouping</tt>, <tt>aggregation</tt>, <tt>reporting_period</tt>, | |
| +<tt>run_limit</tt> | |
| +</p> | |
| + | |
| + </div> | |
| + | |
| + | |
| + </div> | |
| + | |
| + | |
| + </div> | |
| + | |
| + | |
| + <!-- if includes --> | |
| + | |
| + <div id="section"> | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + <!-- if method_list --> | |
| + | |
| + | |
| + </div> | |
| + | |
| + | |
| +<div id="validator-badges"> | |
| + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></sm… | |
| +</div> | |
| + | |
| +</body> | |
| +</html> | |
| +\ No newline at end of file | |
| diff --git a/doc/classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html b/doc… | |
| @@ -1,326 +0,0 @@ | |
| -<?xml version="1.0" encoding="iso-8859-1"?> | |
| -<!DOCTYPE html | |
| - PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
| - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| - | |
| -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
| -<head> | |
| - <title>Class: Simplabs::ReportsAsSparkline::ReportingPeriod</title> | |
| - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
| - <meta http-equiv="Content-Script-Type" content="text/javascript" /> | |
| - <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" medi… | |
| - <script type="text/javascript"> | |
| - // <![CDATA[ | |
| - | |
| - function popupCode( url ) { | |
| - window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=n… | |
| - } | |
| - | |
| - function toggleCode( id ) { | |
| - if ( document.getElementById ) | |
| - elem = document.getElementById( id ); | |
| - else if ( document.all ) | |
| - elem = eval( "document.all." + id ); | |
| - else | |
| - return false; | |
| - | |
| - elemStyle = elem.style; | |
| - | |
| - if ( elemStyle.display != "block" ) { | |
| - elemStyle.display = "block" | |
| - } else { | |
| - elemStyle.display = "none" | |
| - } | |
| - | |
| - return true; | |
| - } | |
| - | |
| - // Make codeblocks hidden by default | |
| - document.writeln( "<style type=\"text/css\">div.method-source-code { display… | |
| - | |
| - // ]]> | |
| - </script> | |
| - | |
| -</head> | |
| -<body> | |
| - | |
| - | |
| - | |
| - <div id="classHeader"> | |
| - <table class="header-table"> | |
| - <tr class="top-aligned-row"> | |
| - <td><strong>Class</strong></td> | |
| - <td class="class-name-in-header">Simplabs::ReportsAsSparkline::Repor… | |
| - </tr> | |
| - <tr class="top-aligned-row"> | |
| - <td><strong>In:</strong></td> | |
| - <td> | |
| - <a href="../../../files/lib/simplabs/reports_as_sparkline/repo… | |
| - lib/simplabs/reports_as_sparkline/reporting_period.rb | |
| - </a> | |
| - <br /> | |
| - </td> | |
| - </tr> | |
| - | |
| - <tr class="top-aligned-row"> | |
| - <td><strong>Parent:</strong></td> | |
| - <td> | |
| - Object | |
| - </td> | |
| - </tr> | |
| - </table> | |
| - </div> | |
| - <!-- banner header --> | |
| - | |
| - <div id="bodyContent"> | |
| - | |
| - | |
| - | |
| - <div id="contextContent"> | |
| - | |
| - <div id="description"> | |
| - <p> | |
| -A <a href="ReportingPeriod.html">ReportingPeriod</a> is - depending on the | |
| -<a href="Grouping.html">Grouping</a> - either a specific hour, a day, a | |
| -month or a year. All records falling into this period will be grouped | |
| -together. | |
| -</p> | |
| - | |
| - </div> | |
| - | |
| - | |
| - </div> | |
| - | |
| - <div id="method-list"> | |
| - <h3 class="section-bar">Methods</h3> | |
| - | |
| - <div class="name-list"> | |
| - <a href="#M000009">first</a> | |
| - <a href="#M000008">new</a> | |
| - <a href="#M000010">next</a> | |
| - <a href="#M000012">offset</a> | |
| - <a href="#M000011">previous</a> | |
| - </div> | |
| - </div> | |
| - | |
| - </div> | |
| - | |
| - | |
| - <!-- if includes --> | |
| - | |
| - <div id="section"> | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - <div id="attribute-list"> | |
| - <h3 class="section-bar">Attributes</h3> | |
| - | |
| - <div class="name-list"> | |
| - <table> | |
| - <tr class="top-aligned-row context-row"> | |
| - <td class="context-item-name">date_time</td> | |
| - <td class="context-item-value"> [R] </td> | |
| - <td class="context-item-desc"></td> | |
| - </tr> | |
| - <tr class="top-aligned-row context-row"> | |
| - <td class="context-item-name">grouping</td> | |
| - <td class="context-item-value"> [R] </td> | |
| - <td class="context-item-desc"></td> | |
| - </tr> | |
| - </table> | |
| - </div> | |
| - </div> | |
| - | |
| - | |
| - | |
| - <!-- if method_list --> | |
| - <div id="methods"> | |
| - <h3 class="section-bar">Public Class methods</h3> | |
| - | |
| - <div id="method-M000009" class="method-detail"> | |
| - <a name="M000009"></a> | |
| - | |
| - <div class="method-heading"> | |
| - <a href="#M000009" class="method-signature"> | |
| - <span class="method-name">first</span><span class="method-args">(gro… | |
| - </a> | |
| - </div> | |
| - | |
| - <div class="method-description"> | |
| - <p> | |
| -Returns the <a href="ReportingPeriod.html#M000009">first</a> reporting | |
| -period for a grouping and a limit; e.g. the <a | |
| -href="ReportingPeriod.html#M000009">first</a> reporting period for <a | |
| -href="Grouping.html">Grouping</a> :day and limit 2 would be Time.now - | |
| -2.days | |
| -</p> | |
| -<h4>Parameters</h4> | |
| -<ul> | |
| -<li><tt>grouping</tt> - The <a | |
| -href="Grouping.html">Simplabs::ReportsAsSparkline::Grouping</a> of the | |
| -reporting period | |
| - | |
| -</li> | |
| -<li><tt>limit</tt> - The number of reporting periods until the <a | |
| -href="ReportingPeriod.html#M000009">first</a> one | |
| - | |
| -</li> | |
| -</ul> | |
| - <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000009-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000009-source"> | |
| -<pre> | |
| - <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/re… | |
| -23: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword k… | |
| -24: <span class="ruby-keyword kw">self</span>.<span class="ruby-identi… | |
| -25: <span class="ruby-keyword kw">end</span> | |
| -</pre> | |
| - </div> | |
| - </div> | |
| - </div> | |
| - | |
| - <div id="method-M000008" class="method-detail"> | |
| - <a name="M000008"></a> | |
| - | |
| - <div class="method-heading"> | |
| - <a href="#M000008" class="method-signature"> | |
| - <span class="method-name">new</span><span class="method-args">(group… | |
| - </a> | |
| - </div> | |
| - | |
| - <div class="method-description"> | |
| - <h4>Parameters</h4> | |
| -<ul> | |
| -<li><tt>grouping</tt> - The <a | |
| -href="Grouping.html">Simplabs::ReportsAsSparkline::Grouping</a> of the | |
| -reporting period | |
| - | |
| -</li> | |
| -<li><tt>date_time</tt> - The DateTime that reporting period is created for | |
| - | |
| -</li> | |
| -</ul> | |
| - <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000008-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000008-source"> | |
| -<pre> | |
| - <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/re… | |
| -13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| -14: <span class="ruby-ivar">@grouping</span> = <span class="ruby-iden… | |
| -15: <span class="ruby-ivar">@date_time</span> = <span class="ruby-iden… | |
| -16: <span class="ruby-keyword kw">end</span> | |
| -</pre> | |
| - </div> | |
| - </div> | |
| - </div> | |
| - | |
| - <h3 class="section-bar">Public Instance methods</h3> | |
| - | |
| - <div id="method-M000010" class="method-detail"> | |
| - <a name="M000010"></a> | |
| - | |
| - <div class="method-heading"> | |
| - <a href="#M000010" class="method-signature"> | |
| - <span class="method-name">next</span><span class="method-args">()</s… | |
| - </a> | |
| - </div> | |
| - | |
| - <div class="method-description"> | |
| - <p> | |
| -Returns the <a href="ReportingPeriod.html#M000010">next</a> reporting | |
| -period (that is <a href="ReportingPeriod.html#M000010">next</a> | |
| -hour/day/month/year) | |
| -</p> | |
| - <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000010-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000010-source"> | |
| -<pre> | |
| - <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/re… | |
| -43: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword k… | |
| -44: <span class="ruby-keyword kw">self</span>.<span class="ruby-identi… | |
| -45: <span class="ruby-keyword kw">end</span> | |
| -</pre> | |
| - </div> | |
| - </div> | |
| - </div> | |
| - | |
| - <div id="method-M000012" class="method-detail"> | |
| - <a name="M000012"></a> | |
| - | |
| - <div class="method-heading"> | |
| - <a href="#M000012" class="method-signature"> | |
| - <span class="method-name">offset</span><span class="method-args">(of… | |
| - </a> | |
| - </div> | |
| - | |
| - <div class="method-description"> | |
| - <p> | |
| -Returns the reporting period with the specified <a | |
| -href="ReportingPeriod.html#M000012">offset</a> from the current | |
| -</p> | |
| -<h4>Parameters</h4> | |
| -<ul> | |
| -<li><tt><a href="ReportingPeriod.html#M000012">offset</a></tt> - The <a | |
| -href="ReportingPeriod.html#M000012">offset</a> to return the reporting | |
| -period for (specifies the <a href="ReportingPeriod.html#M000012">offset</a> | |
| -in hours/days/months/years), depending on the reporting period‘s | |
| -grouping | |
| - | |
| -</li> | |
| -</ul> | |
| - <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000012-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000012-source"> | |
| -<pre> | |
| - <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/re… | |
| -56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| -57: <span class="ruby-keyword kw">self</span>.<span class="ruby-identi… | |
| -58: <span class="ruby-keyword kw">end</span> | |
| -</pre> | |
| - </div> | |
| - </div> | |
| - </div> | |
| - | |
| - <div id="method-M000011" class="method-detail"> | |
| - <a name="M000011"></a> | |
| - | |
| - <div class="method-heading"> | |
| - <a href="#M000011" class="method-signature"> | |
| - <span class="method-name">previous</span><span class="method-args">(… | |
| - </a> | |
| - </div> | |
| - | |
| - <div class="method-description"> | |
| - <p> | |
| -Returns the <a href="ReportingPeriod.html#M000011">previous</a> reporting | |
| -period (that is <a href="ReportingPeriod.html#M000010">next</a> | |
| -hour/day/month/year) | |
| -</p> | |
| - <p><a class="source-toggle" href="#" | |
| - onclick="toggleCode('M000011-source');return false;">[Source]</a><… | |
| - <div class="method-source-code" id="M000011-source"> | |
| -<pre> | |
| - <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/re… | |
| -48: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
| -49: <span class="ruby-keyword kw">self</span>.<span class="ruby-identi… | |
| -50: <span class="ruby-keyword kw">end</span> | |
| -</pre> | |
| - </div> | |
| - </div> | |
| - </div> | |
| - | |
| - | |
| - </div> | |
| - | |
| - | |
| - </div> | |
| - | |
| - | |
| -<div id="validator-badges"> | |
| - <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></sm… | |
| -</div> | |
| - | |
| -</body> | |
| -</html> | |
| -\ No newline at end of file | |
| diff --git a/doc/classes/Simplabs/ReportsAsSparkline/SparklineTagHelper.html b/… | |
| @@ -117,7 +117,8 @@ Renders a sparkline with the given data. | |
| </p> | |
| <h4>Parameters</h4> | |
| <ul> | |
| -<li><tt>data</tt> - The data to render the sparkline for | |
| +<li><tt>data</tt> - The data to render the sparkline for, is retrieved from a | |
| +report like <tt>User.registration_report</tt> | |
| </li> | |
| </ul> | |
| @@ -136,16 +137,17 @@ Renders a sparkline with the given data. | |
| (hex code) | |
| </li> | |
| -<li><tt>labels</tt> - The axes to render lables for (Array of :x, :y, :r, :t; | |
| -this is x axis, y axis, right, top) | |
| +<li><tt>labels</tt> - The axes to render lables for (Array of <tt>:x</tt>, | |
| +<tt>:y+</tt>, <tt>:r</tt>, <tt>:t</tt>; this is x axis, y axis, right, top) | |
| </li> | |
| </ul> | |
| <h4>Example</h4> | |
| <p> | |
| -<%= <a | |
| +<tt><%= <a | |
| href="SparklineTagHelper.html#M000001">sparkline_tag</a>(User.registrations_re… | |
| -:width => 200, :height => 100, :color => ‘000’) %> | |
| +:width => 200, :height => 100, :color => ‘000’) | |
| +%></tt> | |
| </p> | |
| <p><a class="source-toggle" href="#" | |
| onclick="toggleCode('M000001-source');return false;">[Source]</a><… | |
| diff --git a/doc/coverage/index.html b/doc/coverage/index.html | |
| @@ -148,7 +148,7 @@ table.report tr.dark { | |
| </script> | |
| </head> | |
| <body><h3>C0 code coverage information</h3> | |
| - <p>Generated on Wed Apr 29 18:53:07 +0200 2009 with <a href='http://eigenc… | |
| + <p>Generated on Wed Apr 29 19:33:53 +0200 2009 with <a href='http://eigenc… | |
| </p> | |
| <hr/> | |
| <table class='report'><thead><tr><td class='heading'>Name</td> | |
| @@ -159,7 +159,7 @@ table.report tr.dark { | |
| </tr> | |
| </thead> | |
| <tbody><tr class='light'><td>TOTAL</td> | |
| - <td class='lines_total'><tt>586</tt> | |
| + <td class='lines_total'><tt>570</tt> | |
| </td> | |
| <td class='lines_code'><tt>404</tt> | |
| </td> | |
| @@ -186,7 +186,7 @@ table.report tr.dark { | |
| </tr> | |
| <tr class='dark'><td><a href='lib-simplabs-reports_as_sparkline_rb.html'>l… | |
| </td> | |
| - <td class='lines_total'><tt>58</tt> | |
| + <td class='lines_total'><tt>59</tt> | |
| </td> | |
| <td class='lines_code'><tt>22</tt> | |
| </td> | |
| @@ -240,7 +240,7 @@ table.report tr.dark { | |
| </tr> | |
| <tr class='dark'><td><a href='lib-simplabs-reports_as_sparkline-grouping_r… | |
| </td> | |
| - <td class='lines_total'><tt>119</tt> | |
| + <td class='lines_total'><tt>115</tt> | |
| </td> | |
| <td class='lines_code'><tt>99</tt> | |
| </td> | |
| @@ -294,7 +294,7 @@ table.report tr.dark { | |
| </tr> | |
| <tr class='dark'><td><a href='lib-simplabs-reports_as_sparkline-report_cac… | |
| </td> | |
| - <td class='lines_total'><tt>98</tt> | |
| + <td class='lines_total'><tt>100</tt> | |
| </td> | |
| <td class='lines_code'><tt>83</tt> | |
| </td> | |
| @@ -321,11 +321,11 @@ table.report tr.dark { | |
| </tr> | |
| <tr class='light'><td><a href='lib-simplabs-reports_as_sparkline-reporting… | |
| </td> | |
| - <td class='lines_total'><tt>108</tt> | |
| + <td class='lines_total'><tt>93</tt> | |
| </td> | |
| <td class='lines_code'><tt>76</tt> | |
| </td> | |
| - <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt cla… | |
| + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt cla… | |
| </td> | |
| <td><table cellspacing='0' class='percent_graph' cellpadding='0' w… | |
| <td class='uncovered' width='4'/> | |
| diff --git a/doc/coverage/lib-simplabs-reports_as_sparkline-cumulated_report_rb… | |
| @@ -553,7 +553,7 @@ span.run100 { | |
| </style> | |
| </head> | |
| <body><h3>C0 code coverage information</h3> | |
| - <p>Generated on Wed Apr 29 18:53:07 +0200 2009 with <a href='http://eigenc… | |
| + <p>Generated on Wed Apr 29 19:33:53 +0200 2009 with <a href='http://eigenc… | |
| </p> | |
| <hr/> | |
| <pre><span class='marked0'>Code reported as executed by Ruby looks like th… | |
| @@ -598,51 +598,51 @@ span.run100 { | |
| </tr> | |
| </tbody> | |
| </table> | |
| -<pre><span class="marked1"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| -</span><span class="inferred0"><a name="line2"></a> 2 | |
| -</span><span class="marked1"><a name="line3"></a> 3 module ReportsAsSparklin… | |
| -</span><span class="inferred0"><a name="line4"></a> 4 | |
| -</span><span class="inferred1"><a name="line5"></a> 5 # A special report c… | |
| -</span><span class="inferred0"><a name="line6"></a> 6 # | |
| -</span><span class="inferred1"><a name="line7"></a> 7 # ==== Examples | |
| -</span><span class="inferred0"><a name="line8"></a> 8 # | |
| -</span><span class="inferred1"><a name="line9"></a> 9 # When Simplabs::Re… | |
| -</span><span class="inferred0"><a name="line10"></a>10 # | |
| -</span><span class="inferred1"><a name="line11"></a>11 # [[<DateTime… | |
| -</span><span class="inferred0"><a name="line12"></a>12 # | |
| -</span><span class="inferred1"><a name="line13"></a>13 # Simplabs::Report… | |
| -</span><span class="inferred0"><a name="line14"></a>14 # | |
| -</span><span class="inferred1"><a name="line15"></a>15 # [[<DateTime… | |
| -</span><span class="marked0"><a name="line16"></a>16 class CumulatedReport… | |
| -</span><span class="inferred1"><a name="line17"></a>17 | |
| -</span><span class="inferred0"><a name="line18"></a>18 # Runs the report… | |
| -</span><span class="marked1"><a name="line19"></a>19 def run(options = {… | |
| -</span><span class="marked0"><a name="line20"></a>20 cumulate(super, o… | |
| -</span><span class="marked1"><a name="line21"></a>21 end | |
| -</span><span class="inferred0"><a name="line22"></a>22 | |
| -</span><span class="marked1"><a name="line23"></a>23 protected | |
| -</span><span class="inferred0"><a name="line24"></a>24 | |
| -</span><span class="marked1"><a name="line25"></a>25 def cumulate(data… | |
| -</span><span class="marked0"><a name="line26"></a>26 first_reporting… | |
| -</span><span class="marked1"><a name="line27"></a>27 acc = initial_c… | |
| -</span><span class="marked0"><a name="line28"></a>28 result = [] | |
| -</span><span class="marked1"><a name="line29"></a>29 data.each do |e… | |
| -</span><span class="marked0"><a name="line30"></a>30 acc += elemen… | |
| -</span><span class="marked1"><a name="line31"></a>31 result <&l… | |
| -</span><span class="inferred0"><a name="line32"></a>32 end | |
| -</span><span class="marked1"><a name="line33"></a>33 result | |
| -</span><span class="inferred0"><a name="line34"></a>34 end | |
| -</span><span class="inferred1"><a name="line35"></a>35 | |
| -</span><span class="marked0"><a name="line36"></a>36 def initial_cumul… | |
| -</span><span class="marked1"><a name="line37"></a>37 conditions = se… | |
| -</span><span class="marked0"><a name="line38"></a>38 @klass.send(@ag… | |
| -</span><span class="inferred1"><a name="line39"></a>39 end | |
| -</span><span class="inferred0"><a name="line40"></a>40 | |
| -</span><span class="inferred1"><a name="line41"></a>41 end | |
| -</span><span class="inferred0"><a name="line42"></a>42 | |
| -</span><span class="inferred1"><a name="line43"></a>43 end | |
| -</span><span class="inferred0"><a name="line44"></a>44 | |
| -</span><span class="inferred1"><a name="line45"></a>45 end | |
| +<pre><span class="marked0"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| +</span><span class="inferred1"><a name="line2"></a> 2 | |
| +</span><span class="marked0"><a name="line3"></a> 3 module ReportsAsSparklin… | |
| +</span><span class="inferred1"><a name="line4"></a> 4 | |
| +</span><span class="inferred0"><a name="line5"></a> 5 # A special report c… | |
| +</span><span class="inferred1"><a name="line6"></a> 6 # | |
| +</span><span class="inferred0"><a name="line7"></a> 7 # ==== Examples | |
| +</span><span class="inferred1"><a name="line8"></a> 8 # | |
| +</span><span class="inferred0"><a name="line9"></a> 9 # When Simplabs::Rep… | |
| +</span><span class="inferred1"><a name="line10"></a>10 # | |
| +</span><span class="inferred0"><a name="line11"></a>11 # [[<DateTime t… | |
| +</span><span class="inferred1"><a name="line12"></a>12 # | |
| +</span><span class="inferred0"><a name="line13"></a>13 # Simplabs::Reports… | |
| +</span><span class="inferred1"><a name="line14"></a>14 # | |
| +</span><span class="inferred0"><a name="line15"></a>15 # [[<DateTime t… | |
| +</span><span class="marked1"><a name="line16"></a>16 class CumulatedReport… | |
| +</span><span class="inferred0"><a name="line17"></a>17 | |
| +</span><span class="inferred1"><a name="line18"></a>18 # Runs the report… | |
| +</span><span class="marked0"><a name="line19"></a>19 def run(options = {… | |
| +</span><span class="marked1"><a name="line20"></a>20 cumulate(super, o… | |
| +</span><span class="marked0"><a name="line21"></a>21 end | |
| +</span><span class="inferred1"><a name="line22"></a>22 | |
| +</span><span class="marked0"><a name="line23"></a>23 protected | |
| +</span><span class="inferred1"><a name="line24"></a>24 | |
| +</span><span class="marked0"><a name="line25"></a>25 def cumulate(data… | |
| +</span><span class="marked1"><a name="line26"></a>26 first_reporting… | |
| +</span><span class="marked0"><a name="line27"></a>27 acc = initial_c… | |
| +</span><span class="marked1"><a name="line28"></a>28 result = [] | |
| +</span><span class="marked0"><a name="line29"></a>29 data.each do |e… | |
| +</span><span class="marked1"><a name="line30"></a>30 acc += elemen… | |
| +</span><span class="marked0"><a name="line31"></a>31 result <&l… | |
| +</span><span class="inferred1"><a name="line32"></a>32 end | |
| +</span><span class="marked0"><a name="line33"></a>33 result | |
| +</span><span class="inferred1"><a name="line34"></a>34 end | |
| +</span><span class="inferred0"><a name="line35"></a>35 | |
| +</span><span class="marked1"><a name="line36"></a>36 def initial_cumul… | |
| +</span><span class="marked0"><a name="line37"></a>37 conditions = se… | |
| +</span><span class="marked1"><a name="line38"></a>38 @klass.send(@ag… | |
| +</span><span class="inferred0"><a name="line39"></a>39 end | |
| +</span><span class="inferred1"><a name="line40"></a>40 | |
| +</span><span class="inferred0"><a name="line41"></a>41 end | |
| +</span><span class="inferred1"><a name="line42"></a>42 | |
| +</span><span class="inferred0"><a name="line43"></a>43 end | |
| +</span><span class="inferred1"><a name="line44"></a>44 | |
| +</span><span class="inferred0"><a name="line45"></a>45 end | |
| </span></pre><hr/> | |
| <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov c… | |
| version 0.8.1.2.</p> | |
| diff --git a/doc/coverage/lib-simplabs-reports_as_sparkline-grouping_rb.html b/… | |
| @@ -553,7 +553,7 @@ span.run100 { | |
| </style> | |
| </head> | |
| <body><h3>C0 code coverage information</h3> | |
| - <p>Generated on Wed Apr 29 18:53:07 +0200 2009 with <a href='http://eigenc… | |
| + <p>Generated on Wed Apr 29 19:33:53 +0200 2009 with <a href='http://eigenc… | |
| </p> | |
| <hr/> | |
| <pre><span class='marked0'>Code reported as executed by Ruby looks like th… | |
| @@ -571,7 +571,7 @@ span.run100 { | |
| </thead> | |
| <tbody><tr class='light'><td><a href='lib-simplabs-reports_as_sparkline-grou… | |
| </td> | |
| - <td class='lines_total'><tt>119</tt> | |
| + <td class='lines_total'><tt>115</tt> | |
| </td> | |
| <td class='lines_code'><tt>99</tt> | |
| </td> | |
| @@ -598,125 +598,121 @@ span.run100 { | |
| </tr> | |
| </tbody> | |
| </table> | |
| -<pre><span class="marked0"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| -</span><span class="inferred1"><a name="line2"></a> 2 | |
| -</span><span class="marked0"><a name="line3"></a> 3 module ReportsAsSparkli… | |
| -</span><span class="inferred1"><a name="line4"></a> 4 | |
| -</span><span class="inferred0"><a name="line5"></a> 5 # This is the group… | |
| -</span><span class="marked1"><a name="line6"></a> 6 class Grouping | |
| -</span><span class="inferred0"><a name="line7"></a> 7 | |
| -</span><span class="inferred1"><a name="line8"></a> 8 # ==== Parameters | |
| -</span><span class="inferred0"><a name="line9"></a> 9 # * <tt>ide… | |
| -</span><span class="marked1"><a name="line10"></a> 10 def initialize(ide… | |
| -</span><span class="marked0"><a name="line11"></a> 11 raise ArgumentEr… | |
| -</span><span class="marked1"><a name="line12"></a> 12 @identifier = id… | |
| -</span><span class="inferred0"><a name="line13"></a> 13 end | |
| -</span><span class="inferred1"><a name="line14"></a> 14 | |
| -</span><span class="inferred0"><a name="line15"></a> 15 # Returns the Gr… | |
| -</span><span class="marked1"><a name="line16"></a> 16 def identifier | |
| -</span><span class="marked0"><a name="line17"></a> 17 @identifier | |
| -</span><span class="marked1"><a name="line18"></a> 18 end | |
| -</span><span class="inferred0"><a name="line19"></a> 19 | |
| -</span><span class="marked1"><a name="line20"></a> 20 def date_parts_fro… | |
| -</span><span class="marked0"><a name="line21"></a> 21 return case Acti… | |
| -</span><span class="marked1"><a name="line22"></a> 22 when /mysql/i | |
| -</span><span class="marked0"><a name="line23"></a> 23 from_mysql_d… | |
| -</span><span class="marked1"><a name="line24"></a> 24 when /sqlite/i | |
| -</span><span class="marked0"><a name="line25"></a> 25 from_sqlite_… | |
| -</span><span class="marked1"><a name="line26"></a> 26 when /postgres… | |
| -</span><span class="marked0"><a name="line27"></a> 27 from_postgre… | |
| -</span><span class="marked1"><a name="line28"></a> 28 end | |
| -</span><span class="marked0"><a name="line29"></a> 29 end | |
| -</span><span class="inferred1"><a name="line30"></a> 30 | |
| -</span><span class="marked0"><a name="line31"></a> 31 def to_sql(date_co… | |
| -</span><span class="marked1"><a name="line32"></a> 32 return case Acti… | |
| -</span><span class="marked0"><a name="line33"></a> 33 when /mysql/i | |
| -</span><span class="marked1"><a name="line34"></a> 34 mysql_format… | |
| -</span><span class="marked0"><a name="line35"></a> 35 when /sqlite/i | |
| -</span><span class="marked1"><a name="line36"></a> 36 sqlite_forma… | |
| -</span><span class="marked0"><a name="line37"></a> 37 when /postgres… | |
| -</span><span class="marked1"><a name="line38"></a> 38 postgresql_f… | |
| -</span><span class="marked0"><a name="line39"></a> 39 end | |
| -</span><span class="marked1"><a name="line40"></a> 40 end | |
| -</span><span class="inferred0"><a name="line41"></a> 41 | |
| -</span><span class="marked1"><a name="line42"></a> 42 private | |
| -</span><span class="inferred0"><a name="line43"></a> 43 | |
| -</span><span class="marked1"><a name="line44"></a> 44 def from_mysql_d… | |
| -</span><span class="marked0"><a name="line45"></a> 45 if @identifier… | |
| -</span><span class="marked1"><a name="line46"></a> 46 parts = [db_… | |
| -</span><span class="inferred0"><a name="line47"></a> 47 else | |
| -</span><span class="marked1"><a name="line48"></a> 48 db_string.sp… | |
| -</span><span class="inferred0"><a name="line49"></a> 49 end | |
| -</span><span class="marked1"><a name="line50"></a> 50 end | |
| -</span><span class="inferred0"><a name="line51"></a> 51 | |
| -</span><span class="marked1"><a name="line52"></a> 52 def from_sqlite_… | |
| -</span><span class="marked0"><a name="line53"></a> 53 if @identifier… | |
| -</span><span class="marked1"><a name="line54"></a> 54 parts = db_s… | |
| -</span><span class="marked0"><a name="line55"></a> 55 date = Date.… | |
| -</span><span class="marked1"><a name="line56"></a> 56 return [date… | |
| -</span><span class="inferred0"><a name="line57"></a> 57 end | |
| -</span><span class="marked1"><a name="line58"></a> 58 db_string.spli… | |
| -</span><span class="inferred0"><a name="line59"></a> 59 end | |
| -</span><span class="inferred1"><a name="line60"></a> 60 | |
| -</span><span class="marked0"><a name="line61"></a> 61 def from_postgre… | |
| -</span><span class="marked1"><a name="line62"></a> 62 case @identifi… | |
| -</span><span class="marked0"><a name="line63"></a> 63 when :hour | |
| -</span><span class="marked1"><a name="line64"></a> 64 return (db… | |
| -</span><span class="marked0"><a name="line65"></a> 65 when :day | |
| -</span><span class="marked1"><a name="line66"></a> 66 return db_… | |
| -</span><span class="marked0"><a name="line67"></a> 67 when :week | |
| -</span><span class="marked1"><a name="line68"></a> 68 parts = db… | |
| -</span><span class="marked0"><a name="line69"></a> 69 date = Dat… | |
| -</span><span class="marked1"><a name="line70"></a> 70 return [da… | |
| -</span><span class="marked0"><a name="line71"></a> 71 when :month | |
| -</span><span class="marked1"><a name="line72"></a> 72 return db_… | |
| -</span><span class="inferred0"><a name="line73"></a> 73 end | |
| -</span><span class="marked1"><a name="line74"></a> 74 end | |
| -</span><span class="inferred0"><a name="line75"></a> 75 | |
| -</span><span class="marked1"><a name="line76"></a> 76 def mysql_format… | |
| -</span><span class="uncovered0"><a name="line77"></a> 77 return case… | |
| -</span><span class="marked1"><a name="line78"></a> 78 when :hour | |
| -</span><span class="marked0"><a name="line79"></a> 79 "DATE… | |
| -</span><span class="marked1"><a name="line80"></a> 80 when :day | |
| -</span><span class="marked0"><a name="line81"></a> 81 "DATE… | |
| -</span><span class="marked1"><a name="line82"></a> 82 when :week | |
| -</span><span class="marked0"><a name="line83"></a> 83 "YEAR… | |
| -</span><span class="marked1"><a name="line84"></a> 84 when :month | |
| -</span><span class="marked0"><a name="line85"></a> 85 "DATE… | |
| -</span><span class="marked1"><a name="line86"></a> 86 end | |
| -</span><span class="marked0"><a name="line87"></a> 87 end | |
| -</span><span class="inferred1"><a name="line88"></a> 88 | |
| -</span><span class="marked0"><a name="line89"></a> 89 def sqlite_forma… | |
| -</span><span class="uncovered1"><a name="line90"></a> 90 return case… | |
| -</span><span class="marked0"><a name="line91"></a> 91 when :hour | |
| -</span><span class="marked1"><a name="line92"></a> 92 "strf… | |
| -</span><span class="marked0"><a name="line93"></a> 93 when :day | |
| -</span><span class="marked1"><a name="line94"></a> 94 "strf… | |
| -</span><span class="marked0"><a name="line95"></a> 95 when :week | |
| -</span><span class="marked1"><a name="line96"></a> 96 "date… | |
| -</span><span class="marked0"><a name="line97"></a> 97 when :month | |
| -</span><span class="marked1"><a name="line98"></a> 98 "strf… | |
| -</span><span class="marked0"><a name="line99"></a> 99 end | |
| -</span><span class="marked1"><a name="line100"></a>100 end | |
| -</span><span class="inferred0"><a name="line101"></a>101 | |
| -</span><span class="marked1"><a name="line102"></a>102 def postgresql_… | |
| -</span><span class="inferred0"><a name="line103"></a>103 return case… | |
| -</span><span class="marked1"><a name="line104"></a>104 when :hour | |
| -</span><span class="inferred0"><a name="line105"></a>105 "d… | |
| -</span><span class="marked1"><a name="line106"></a>106 when :day | |
| -</span><span class="inferred0"><a name="line107"></a>107 "d… | |
| -</span><span class="marked1"><a name="line108"></a>108 when :week | |
| -</span><span class="inferred0"><a name="line109"></a>109 "d… | |
| -</span><span class="marked1"><a name="line110"></a>110 when :month | |
| -</span><span class="marked0"><a name="line111"></a>111 "dat… | |
| -</span><span class="marked1"><a name="line112"></a>112 end | |
| -</span><span class="marked0"><a name="line113"></a>113 end | |
| -</span><span class="inferred1"><a name="line114"></a>114 | |
| -</span><span class="inferred0"><a name="line115"></a>115 end | |
| -</span><span class="inferred1"><a name="line116"></a>116 | |
| -</span><span class="inferred0"><a name="line117"></a>117 end | |
| -</span><span class="inferred1"><a name="line118"></a>118 | |
| -</span><span class="inferred0"><a name="line119"></a>119 end | |
| +<pre><span class="marked1"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| +</span><span class="inferred0"><a name="line2"></a> 2 | |
| +</span><span class="marked1"><a name="line3"></a> 3 module ReportsAsSparkli… | |
| +</span><span class="inferred0"><a name="line4"></a> 4 | |
| +</span><span class="marked1"><a name="line5"></a> 5 class Grouping #:nodo… | |
| +</span><span class="inferred0"><a name="line6"></a> 6 | |
| +</span><span class="marked1"><a name="line7"></a> 7 def initialize(iden… | |
| +</span><span class="marked0"><a name="line8"></a> 8 raise ArgumentErr… | |
| +</span><span class="marked1"><a name="line9"></a> 9 @identifier = ide… | |
| +</span><span class="inferred0"><a name="line10"></a> 10 end | |
| +</span><span class="inferred1"><a name="line11"></a> 11 | |
| +</span><span class="marked0"><a name="line12"></a> 12 def identifier | |
| +</span><span class="marked1"><a name="line13"></a> 13 @identifier | |
| +</span><span class="marked0"><a name="line14"></a> 14 end | |
| +</span><span class="inferred1"><a name="line15"></a> 15 | |
| +</span><span class="marked0"><a name="line16"></a> 16 def date_parts_fro… | |
| +</span><span class="marked1"><a name="line17"></a> 17 return case Acti… | |
| +</span><span class="marked0"><a name="line18"></a> 18 when /mysql/i | |
| +</span><span class="marked1"><a name="line19"></a> 19 from_mysql_d… | |
| +</span><span class="marked0"><a name="line20"></a> 20 when /sqlite/i | |
| +</span><span class="marked1"><a name="line21"></a> 21 from_sqlite_… | |
| +</span><span class="marked0"><a name="line22"></a> 22 when /postgres… | |
| +</span><span class="marked1"><a name="line23"></a> 23 from_postgre… | |
| +</span><span class="marked0"><a name="line24"></a> 24 end | |
| +</span><span class="marked1"><a name="line25"></a> 25 end | |
| +</span><span class="inferred0"><a name="line26"></a> 26 | |
| +</span><span class="marked1"><a name="line27"></a> 27 def to_sql(date_co… | |
| +</span><span class="marked0"><a name="line28"></a> 28 return case Acti… | |
| +</span><span class="marked1"><a name="line29"></a> 29 when /mysql/i | |
| +</span><span class="marked0"><a name="line30"></a> 30 mysql_format… | |
| +</span><span class="marked1"><a name="line31"></a> 31 when /sqlite/i | |
| +</span><span class="marked0"><a name="line32"></a> 32 sqlite_forma… | |
| +</span><span class="marked1"><a name="line33"></a> 33 when /postgres… | |
| +</span><span class="marked0"><a name="line34"></a> 34 postgresql_f… | |
| +</span><span class="marked1"><a name="line35"></a> 35 end | |
| +</span><span class="marked0"><a name="line36"></a> 36 end | |
| +</span><span class="inferred1"><a name="line37"></a> 37 | |
| +</span><span class="marked0"><a name="line38"></a> 38 private | |
| +</span><span class="inferred1"><a name="line39"></a> 39 | |
| +</span><span class="marked0"><a name="line40"></a> 40 def from_mysql_d… | |
| +</span><span class="marked1"><a name="line41"></a> 41 if @identifier… | |
| +</span><span class="marked0"><a name="line42"></a> 42 parts = [db_… | |
| +</span><span class="inferred1"><a name="line43"></a> 43 else | |
| +</span><span class="marked0"><a name="line44"></a> 44 db_string.sp… | |
| +</span><span class="inferred1"><a name="line45"></a> 45 end | |
| +</span><span class="marked0"><a name="line46"></a> 46 end | |
| +</span><span class="inferred1"><a name="line47"></a> 47 | |
| +</span><span class="marked0"><a name="line48"></a> 48 def from_sqlite_… | |
| +</span><span class="marked1"><a name="line49"></a> 49 if @identifier… | |
| +</span><span class="marked0"><a name="line50"></a> 50 parts = db_s… | |
| +</span><span class="marked1"><a name="line51"></a> 51 date = Date.… | |
| +</span><span class="marked0"><a name="line52"></a> 52 return [date… | |
| +</span><span class="inferred1"><a name="line53"></a> 53 end | |
| +</span><span class="marked0"><a name="line54"></a> 54 db_string.spli… | |
| +</span><span class="inferred1"><a name="line55"></a> 55 end | |
| +</span><span class="inferred0"><a name="line56"></a> 56 | |
| +</span><span class="marked1"><a name="line57"></a> 57 def from_postgre… | |
| +</span><span class="marked0"><a name="line58"></a> 58 case @identifi… | |
| +</span><span class="marked1"><a name="line59"></a> 59 when :hour | |
| +</span><span class="marked0"><a name="line60"></a> 60 return (db… | |
| +</span><span class="marked1"><a name="line61"></a> 61 when :day | |
| +</span><span class="marked0"><a name="line62"></a> 62 return db_… | |
| +</span><span class="marked1"><a name="line63"></a> 63 when :week | |
| +</span><span class="marked0"><a name="line64"></a> 64 parts = db… | |
| +</span><span class="marked1"><a name="line65"></a> 65 date = Dat… | |
| +</span><span class="marked0"><a name="line66"></a> 66 return [da… | |
| +</span><span class="marked1"><a name="line67"></a> 67 when :month | |
| +</span><span class="marked0"><a name="line68"></a> 68 return db_… | |
| +</span><span class="inferred1"><a name="line69"></a> 69 end | |
| +</span><span class="marked0"><a name="line70"></a> 70 end | |
| +</span><span class="inferred1"><a name="line71"></a> 71 | |
| +</span><span class="marked0"><a name="line72"></a> 72 def mysql_format… | |
| +</span><span class="uncovered1"><a name="line73"></a> 73 return case… | |
| +</span><span class="marked0"><a name="line74"></a> 74 when :hour | |
| +</span><span class="marked1"><a name="line75"></a> 75 "DATE… | |
| +</span><span class="marked0"><a name="line76"></a> 76 when :day | |
| +</span><span class="marked1"><a name="line77"></a> 77 "DATE… | |
| +</span><span class="marked0"><a name="line78"></a> 78 when :week | |
| +</span><span class="marked1"><a name="line79"></a> 79 "YEAR… | |
| +</span><span class="marked0"><a name="line80"></a> 80 when :month | |
| +</span><span class="marked1"><a name="line81"></a> 81 "DATE… | |
| +</span><span class="marked0"><a name="line82"></a> 82 end | |
| +</span><span class="marked1"><a name="line83"></a> 83 end | |
| +</span><span class="inferred0"><a name="line84"></a> 84 | |
| +</span><span class="marked1"><a name="line85"></a> 85 def sqlite_forma… | |
| +</span><span class="uncovered0"><a name="line86"></a> 86 return case… | |
| +</span><span class="marked1"><a name="line87"></a> 87 when :hour | |
| +</span><span class="marked0"><a name="line88"></a> 88 "strf… | |
| +</span><span class="marked1"><a name="line89"></a> 89 when :day | |
| +</span><span class="marked0"><a name="line90"></a> 90 "strf… | |
| +</span><span class="marked1"><a name="line91"></a> 91 when :week | |
| +</span><span class="marked0"><a name="line92"></a> 92 "date… | |
| +</span><span class="marked1"><a name="line93"></a> 93 when :month | |
| +</span><span class="marked0"><a name="line94"></a> 94 "strf… | |
| +</span><span class="marked1"><a name="line95"></a> 95 end | |
| +</span><span class="marked0"><a name="line96"></a> 96 end | |
| +</span><span class="inferred1"><a name="line97"></a> 97 | |
| +</span><span class="marked0"><a name="line98"></a> 98 def postgresql_f… | |
| +</span><span class="inferred1"><a name="line99"></a> 99 return case … | |
| +</span><span class="marked0"><a name="line100"></a>100 when :hour | |
| +</span><span class="inferred1"><a name="line101"></a>101 "d… | |
| +</span><span class="marked0"><a name="line102"></a>102 when :day | |
| +</span><span class="inferred1"><a name="line103"></a>103 "d… | |
| +</span><span class="marked0"><a name="line104"></a>104 when :week | |
| +</span><span class="inferred1"><a name="line105"></a>105 "d… | |
| +</span><span class="marked0"><a name="line106"></a>106 when :month | |
| +</span><span class="marked1"><a name="line107"></a>107 "dat… | |
| +</span><span class="marked0"><a name="line108"></a>108 end | |
| +</span><span class="marked1"><a name="line109"></a>109 end | |
| +</span><span class="inferred0"><a name="line110"></a>110 | |
| +</span><span class="inferred1"><a name="line111"></a>111 end | |
| +</span><span class="inferred0"><a name="line112"></a>112 | |
| +</span><span class="inferred1"><a name="line113"></a>113 end | |
| +</span><span class="inferred0"><a name="line114"></a>114 | |
| +</span><span class="inferred1"><a name="line115"></a>115 end | |
| </span></pre><hr/> | |
| <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov c… | |
| version 0.8.1.2.</p> | |
| diff --git a/doc/coverage/lib-simplabs-reports_as_sparkline-report_cache_rb.htm… | |
| @@ -553,7 +553,7 @@ span.run100 { | |
| </style> | |
| </head> | |
| <body><h3>C0 code coverage information</h3> | |
| - <p>Generated on Wed Apr 29 18:53:08 +0200 2009 with <a href='http://eigenc… | |
| + <p>Generated on Wed Apr 29 19:33:53 +0200 2009 with <a href='http://eigenc… | |
| </p> | |
| <hr/> | |
| <pre><span class='marked0'>Code reported as executed by Ruby looks like th… | |
| @@ -571,7 +571,7 @@ span.run100 { | |
| </thead> | |
| <tbody><tr class='light'><td><a href='lib-simplabs-reports_as_sparkline-repo… | |
| </td> | |
| - <td class='lines_total'><tt>98</tt> | |
| + <td class='lines_total'><tt>100</tt> | |
| </td> | |
| <td class='lines_code'><tt>83</tt> | |
| </td> | |
| @@ -598,104 +598,106 @@ span.run100 { | |
| </tr> | |
| </tbody> | |
| </table> | |
| -<pre><span class="marked0"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| -</span><span class="inferred1"><a name="line2"></a> 2 | |
| -</span><span class="marked0"><a name="line3"></a> 3 module ReportsAsSparklin… | |
| -</span><span class="inferred1"><a name="line4"></a> 4 | |
| -</span><span class="marked0"><a name="line5"></a> 5 class ReportCache <… | |
| -</span><span class="inferred1"><a name="line6"></a> 6 | |
| -</span><span class="marked0"><a name="line7"></a> 7 set_table_name :repo… | |
| -</span><span class="inferred1"><a name="line8"></a> 8 | |
| -</span><span class="marked0"><a name="line9"></a> 9 def self.process(rep… | |
| -</span><span class="marked1"><a name="line10"></a>10 raise ArgumentErr… | |
| -</span><span class="marked0"><a name="line11"></a>11 self.transaction … | |
| -</span><span class="marked1"><a name="line12"></a>12 cached_data = [] | |
| -</span><span class="marked0"><a name="line13"></a>13 first_reporting… | |
| -</span><span class="marked1"><a name="line14"></a>14 last_reporting_… | |
| -</span><span class="inferred0"><a name="line15"></a>15 | |
| -</span><span class="marked1"><a name="line16"></a>16 if cache | |
| -</span><span class="marked0"><a name="line17"></a>17 cached_data =… | |
| -</span><span class="marked1"><a name="line18"></a>18 first_cached_… | |
| -</span><span class="marked0"><a name="line19"></a>19 last_cached_r… | |
| -</span><span class="inferred1"><a name="line20"></a>20 end | |
| -</span><span class="inferred0"><a name="line21"></a>21 | |
| -</span><span class="marked1"><a name="line22"></a>22 new_data = if !… | |
| -</span><span class="uncovered0"><a name="line23"></a>23 [] | |
| -</span><span class="inferred1"><a name="line24"></a>24 else | |
| -</span><span class="marked0"><a name="line25"></a>25 end_date = op… | |
| -</span><span class="marked1"><a name="line26"></a>26 yield((last_c… | |
| -</span><span class="inferred0"><a name="line27"></a>27 end | |
| -</span><span class="inferred1"><a name="line28"></a>28 | |
| -</span><span class="marked0"><a name="line29"></a>29 prepare_result(… | |
| -</span><span class="inferred1"><a name="line30"></a>30 end | |
| -</span><span class="inferred0"><a name="line31"></a>31 end | |
| -</span><span class="inferred1"><a name="line32"></a>32 | |
| -</span><span class="marked0"><a name="line33"></a>33 private | |
| -</span><span class="inferred1"><a name="line34"></a>34 | |
| -</span><span class="marked0"><a name="line35"></a>35 def self.prepare_… | |
| -</span><span class="marked1"><a name="line36"></a>36 new_data = new_… | |
| -</span><span class="marked0"><a name="line37"></a>37 result = cached… | |
| -</span><span class="marked1"><a name="line38"></a>38 last_reporting_… | |
| -</span><span class="marked0"><a name="line39"></a>39 reporting_perio… | |
| -</span><span class="marked1"><a name="line40"></a>40 while reporting… | |
| -</span><span class="marked0"><a name="line41"></a>41 cached = buil… | |
| -</span><span class="marked1"><a name="line42"></a>42 cached.save! … | |
| -</span><span class="marked0"><a name="line43"></a>43 result <&l… | |
| -</span><span class="marked1"><a name="line44"></a>44 reporting_per… | |
| -</span><span class="inferred0"><a name="line45"></a>45 end | |
| -</span><span class="marked1"><a name="line46"></a>46 if options[:liv… | |
| -</span><span class="marked0"><a name="line47"></a>47 result <&l… | |
| -</span><span class="inferred1"><a name="line48"></a>48 end | |
| -</span><span class="marked0"><a name="line49"></a>49 result | |
| -</span><span class="inferred1"><a name="line50"></a>50 end | |
| -</span><span class="inferred0"><a name="line51"></a>51 | |
| -</span><span class="marked1"><a name="line52"></a>52 def self.find_val… | |
| -</span><span class="marked0"><a name="line53"></a>53 data = data.det… | |
| -</span><span class="marked1"><a name="line54"></a>54 data ? data[1] … | |
| -</span><span class="inferred0"><a name="line55"></a>55 end | |
| -</span><span class="inferred1"><a name="line56"></a>56 | |
| -</span><span class="marked0"><a name="line57"></a>57 def self.build_ca… | |
| -</span><span class="marked1"><a name="line58"></a>58 self.new( | |
| -</span><span class="inferred0"><a name="line59"></a>59 :model_name… | |
| -</span><span class="inferred1"><a name="line60"></a>60 :report_nam… | |
| -</span><span class="marked0"><a name="line61"></a>61 :grouping … | |
| -</span><span class="inferred1"><a name="line62"></a>62 :aggregatio… | |
| -</span><span class="inferred0"><a name="line63"></a>63 :reporting_… | |
| -</span><span class="inferred1"><a name="line64"></a>64 :value … | |
| -</span><span class="inferred0"><a name="line65"></a>65 :run_limit … | |
| -</span><span class="inferred1"><a name="line66"></a>66 ) | |
| -</span><span class="marked0"><a name="line67"></a>67 end | |
| -</span><span class="inferred1"><a name="line68"></a>68 | |
| -</span><span class="marked0"><a name="line69"></a>69 def self.find_cac… | |
| -</span><span class="marked1"><a name="line70"></a>70 conditions = [ | |
| -</span><span class="inferred0"><a name="line71"></a>71 'model_name… | |
| -</span><span class="inferred1"><a name="line72"></a>72 report.klas… | |
| -</span><span class="inferred0"><a name="line73"></a>73 report.name… | |
| -</span><span class="marked1"><a name="line74"></a>74 options[:grou… | |
| -</span><span class="inferred0"><a name="line75"></a>75 report.aggr… | |
| -</span><span class="inferred1"><a name="line76"></a>76 options[:li… | |
| -</span><span class="inferred0"><a name="line77"></a>77 ] | |
| -</span><span class="marked1"><a name="line78"></a>78 if last_reporti… | |
| -</span><span class="marked0"><a name="line79"></a>79 conditions.fi… | |
| -</span><span class="marked1"><a name="line80"></a>80 conditions &l… | |
| -</span><span class="marked0"><a name="line81"></a>81 conditions &l… | |
| -</span><span class="inferred1"><a name="line82"></a>82 else | |
| -</span><span class="marked0"><a name="line83"></a>83 conditions.fi… | |
| -</span><span class="marked1"><a name="line84"></a>84 conditions &l… | |
| -</span><span class="inferred0"><a name="line85"></a>85 end | |
| -</span><span class="marked1"><a name="line86"></a>86 self.find( | |
| -</span><span class="inferred0"><a name="line87"></a>87 :all, | |
| -</span><span class="inferred1"><a name="line88"></a>88 :conditions… | |
| -</span><span class="inferred0"><a name="line89"></a>89 :limit =>… | |
| -</span><span class="inferred1"><a name="line90"></a>90 :order =>… | |
| -</span><span class="inferred0"><a name="line91"></a>91 ) | |
| -</span><span class="inferred1"><a name="line92"></a>92 end | |
| -</span><span class="inferred0"><a name="line93"></a>93 | |
| -</span><span class="inferred1"><a name="line94"></a>94 end | |
| -</span><span class="inferred0"><a name="line95"></a>95 | |
| -</span><span class="inferred1"><a name="line96"></a>96 end | |
| -</span><span class="inferred0"><a name="line97"></a>97 | |
| -</span><span class="inferred1"><a name="line98"></a>98 end | |
| +<pre><span class="marked1"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| +</span><span class="inferred0"><a name="line2"></a> 2 | |
| +</span><span class="marked1"><a name="line3"></a> 3 module ReportsAsSparkli… | |
| +</span><span class="inferred0"><a name="line4"></a> 4 | |
| +</span><span class="inferred1"><a name="line5"></a> 5 # The ReportCache c… | |
| +</span><span class="inferred0"><a name="line6"></a> 6 # ReportCache insta… | |
| +</span><span class="marked1"><a name="line7"></a> 7 class ReportCache <… | |
| +</span><span class="inferred0"><a name="line8"></a> 8 | |
| +</span><span class="marked1"><a name="line9"></a> 9 set_table_name :rep… | |
| +</span><span class="inferred0"><a name="line10"></a> 10 | |
| +</span><span class="marked1"><a name="line11"></a> 11 def self.process(r… | |
| +</span><span class="marked0"><a name="line12"></a> 12 raise ArgumentEr… | |
| +</span><span class="marked1"><a name="line13"></a> 13 self.transaction… | |
| +</span><span class="marked0"><a name="line14"></a> 14 cached_data = … | |
| +</span><span class="marked1"><a name="line15"></a> 15 first_reportin… | |
| +</span><span class="marked0"><a name="line16"></a> 16 last_reporting… | |
| +</span><span class="inferred1"><a name="line17"></a> 17 | |
| +</span><span class="marked0"><a name="line18"></a> 18 if cache | |
| +</span><span class="marked1"><a name="line19"></a> 19 cached_data … | |
| +</span><span class="marked0"><a name="line20"></a> 20 first_cached… | |
| +</span><span class="marked1"><a name="line21"></a> 21 last_cached_… | |
| +</span><span class="inferred0"><a name="line22"></a> 22 end | |
| +</span><span class="inferred1"><a name="line23"></a> 23 | |
| +</span><span class="marked0"><a name="line24"></a> 24 new_data = if … | |
| +</span><span class="uncovered1"><a name="line25"></a> 25 [] | |
| +</span><span class="inferred0"><a name="line26"></a> 26 else | |
| +</span><span class="marked1"><a name="line27"></a> 27 end_date = o… | |
| +</span><span class="marked0"><a name="line28"></a> 28 yield((last_… | |
| +</span><span class="inferred1"><a name="line29"></a> 29 end | |
| +</span><span class="inferred0"><a name="line30"></a> 30 | |
| +</span><span class="marked1"><a name="line31"></a> 31 prepare_result… | |
| +</span><span class="inferred0"><a name="line32"></a> 32 end | |
| +</span><span class="inferred1"><a name="line33"></a> 33 end | |
| +</span><span class="inferred0"><a name="line34"></a> 34 | |
| +</span><span class="marked1"><a name="line35"></a> 35 private | |
| +</span><span class="inferred0"><a name="line36"></a> 36 | |
| +</span><span class="marked1"><a name="line37"></a> 37 def self.prepare… | |
| +</span><span class="marked0"><a name="line38"></a> 38 new_data = new… | |
| +</span><span class="marked1"><a name="line39"></a> 39 result = cache… | |
| +</span><span class="marked0"><a name="line40"></a> 40 last_reporting… | |
| +</span><span class="marked1"><a name="line41"></a> 41 reporting_peri… | |
| +</span><span class="marked0"><a name="line42"></a> 42 while reportin… | |
| +</span><span class="marked1"><a name="line43"></a> 43 cached = bui… | |
| +</span><span class="marked0"><a name="line44"></a> 44 cached.save!… | |
| +</span><span class="marked1"><a name="line45"></a> 45 result <&… | |
| +</span><span class="marked0"><a name="line46"></a> 46 reporting_pe… | |
| +</span><span class="inferred1"><a name="line47"></a> 47 end | |
| +</span><span class="marked0"><a name="line48"></a> 48 if options[:li… | |
| +</span><span class="marked1"><a name="line49"></a> 49 result <&… | |
| +</span><span class="inferred0"><a name="line50"></a> 50 end | |
| +</span><span class="marked1"><a name="line51"></a> 51 result | |
| +</span><span class="inferred0"><a name="line52"></a> 52 end | |
| +</span><span class="inferred1"><a name="line53"></a> 53 | |
| +</span><span class="marked0"><a name="line54"></a> 54 def self.find_va… | |
| +</span><span class="marked1"><a name="line55"></a> 55 data = data.de… | |
| +</span><span class="marked0"><a name="line56"></a> 56 data ? data[1]… | |
| +</span><span class="inferred1"><a name="line57"></a> 57 end | |
| +</span><span class="inferred0"><a name="line58"></a> 58 | |
| +</span><span class="marked1"><a name="line59"></a> 59 def self.build_c… | |
| +</span><span class="marked0"><a name="line60"></a> 60 self.new( | |
| +</span><span class="inferred1"><a name="line61"></a> 61 :model_nam… | |
| +</span><span class="inferred0"><a name="line62"></a> 62 :report_na… | |
| +</span><span class="marked1"><a name="line63"></a> 63 :grouping … | |
| +</span><span class="inferred0"><a name="line64"></a> 64 :aggregati… | |
| +</span><span class="inferred1"><a name="line65"></a> 65 :reporting… | |
| +</span><span class="inferred0"><a name="line66"></a> 66 :value … | |
| +</span><span class="inferred1"><a name="line67"></a> 67 :run_limit… | |
| +</span><span class="inferred0"><a name="line68"></a> 68 ) | |
| +</span><span class="marked1"><a name="line69"></a> 69 end | |
| +</span><span class="inferred0"><a name="line70"></a> 70 | |
| +</span><span class="marked1"><a name="line71"></a> 71 def self.find_ca… | |
| +</span><span class="marked0"><a name="line72"></a> 72 conditions = [ | |
| +</span><span class="inferred1"><a name="line73"></a> 73 'model_nam… | |
| +</span><span class="inferred0"><a name="line74"></a> 74 report.kla… | |
| +</span><span class="inferred1"><a name="line75"></a> 75 report.nam… | |
| +</span><span class="marked0"><a name="line76"></a> 76 options[:gro… | |
| +</span><span class="inferred1"><a name="line77"></a> 77 report.agg… | |
| +</span><span class="inferred0"><a name="line78"></a> 78 options[:l… | |
| +</span><span class="inferred1"><a name="line79"></a> 79 ] | |
| +</span><span class="marked0"><a name="line80"></a> 80 if last_report… | |
| +</span><span class="marked1"><a name="line81"></a> 81 conditions.f… | |
| +</span><span class="marked0"><a name="line82"></a> 82 conditions &… | |
| +</span><span class="marked1"><a name="line83"></a> 83 conditions &… | |
| +</span><span class="inferred0"><a name="line84"></a> 84 else | |
| +</span><span class="marked1"><a name="line85"></a> 85 conditions.f… | |
| +</span><span class="marked0"><a name="line86"></a> 86 conditions &… | |
| +</span><span class="inferred1"><a name="line87"></a> 87 end | |
| +</span><span class="marked0"><a name="line88"></a> 88 self.find( | |
| +</span><span class="inferred1"><a name="line89"></a> 89 :all, | |
| +</span><span class="inferred0"><a name="line90"></a> 90 :condition… | |
| +</span><span class="inferred1"><a name="line91"></a> 91 :limit =&g… | |
| +</span><span class="inferred0"><a name="line92"></a> 92 :order =&g… | |
| +</span><span class="inferred1"><a name="line93"></a> 93 ) | |
| +</span><span class="inferred0"><a name="line94"></a> 94 end | |
| +</span><span class="inferred1"><a name="line95"></a> 95 | |
| +</span><span class="inferred0"><a name="line96"></a> 96 end | |
| +</span><span class="inferred1"><a name="line97"></a> 97 | |
| +</span><span class="inferred0"><a name="line98"></a> 98 end | |
| +</span><span class="inferred1"><a name="line99"></a> 99 | |
| +</span><span class="inferred0"><a name="line100"></a>100 end | |
| </span></pre><hr/> | |
| <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov c… | |
| version 0.8.1.2.</p> | |
| diff --git a/doc/coverage/lib-simplabs-reports_as_sparkline-report_rb.html b/do… | |
| @@ -553,7 +553,7 @@ span.run100 { | |
| </style> | |
| </head> | |
| <body><h3>C0 code coverage information</h3> | |
| - <p>Generated on Wed Apr 29 18:53:07 +0200 2009 with <a href='http://eigenc… | |
| + <p>Generated on Wed Apr 29 19:33:53 +0200 2009 with <a href='http://eigenc… | |
| </p> | |
| <hr/> | |
| <pre><span class='marked0'>Code reported as executed by Ruby looks like th… | |
| @@ -598,125 +598,125 @@ span.run100 { | |
| </tr> | |
| </tbody> | |
| </table> | |
| -<pre><span class="marked1"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| -</span><span class="inferred0"><a name="line2"></a> 2 | |
| -</span><span class="marked1"><a name="line3"></a> 3 module ReportsAsSparkli… | |
| -</span><span class="inferred0"><a name="line4"></a> 4 | |
| -</span><span class="inferred1"><a name="line5"></a> 5 # The Report class … | |
| -</span><span class="marked0"><a name="line6"></a> 6 class Report | |
| -</span><span class="inferred1"><a name="line7"></a> 7 | |
| -</span><span class="marked0"><a name="line8"></a> 8 attr_reader :klass,… | |
| -</span><span class="inferred1"><a name="line9"></a> 9 | |
| -</span><span class="inferred0"><a name="line10"></a> 10 # ==== Parameters | |
| -</span><span class="inferred1"><a name="line11"></a> 11 # * <tt>kl… | |
| -</span><span class="inferred0"><a name="line12"></a> 12 # * <tt>na… | |
| -</span><span class="inferred1"><a name="line13"></a> 13 # | |
| -</span><span class="inferred0"><a name="line14"></a> 14 # ==== Options | |
| -</span><span class="inferred1"><a name="line15"></a> 15 # | |
| -</span><span class="inferred0"><a name="line16"></a> 16 # * <tt>:d… | |
| -</span><span class="inferred1"><a name="line17"></a> 17 # * <tt>:v… | |
| -</span><span class="inferred0"><a name="line18"></a> 18 # * <tt>:a… | |
| -</span><span class="inferred1"><a name="line19"></a> 19 # * <tt>:g… | |
| -</span><span class="inferred0"><a name="line20"></a> 20 # * <tt>:l… | |
| -</span><span class="inferred1"><a name="line21"></a> 21 # * <tt>:c… | |
| -</span><span class="inferred0"><a name="line22"></a> 22 # * <tt>:l… | |
| -</span><span class="inferred1"><a name="line23"></a> 23 # * <tt>:e… | |
| -</span><span class="marked0"><a name="line24"></a> 24 def initialize(kla… | |
| -</span><span class="marked1"><a name="line25"></a> 25 ensure_valid_opt… | |
| -</span><span class="marked0"><a name="line26"></a> 26 @klass = … | |
| -</span><span class="marked1"><a name="line27"></a> 27 @name = … | |
| -</span><span class="marked0"><a name="line28"></a> 28 @date_column = … | |
| -</span><span class="marked1"><a name="line29"></a> 29 @aggregation = … | |
| -</span><span class="marked0"><a name="line30"></a> 30 @value_column = … | |
| -</span><span class="marked1"><a name="line31"></a> 31 @options = { | |
| -</span><span class="inferred0"><a name="line32"></a> 32 :limit … | |
| -</span><span class="inferred1"><a name="line33"></a> 33 :conditions … | |
| -</span><span class="marked0"><a name="line34"></a> 34 :grouping =&… | |
| -</span><span class="inferred1"><a name="line35"></a> 35 :live_data … | |
| -</span><span class="inferred0"><a name="line36"></a> 36 :end_date … | |
| -</span><span class="inferred1"><a name="line37"></a> 37 } | |
| -</span><span class="marked0"><a name="line38"></a> 38 @options.merge!(… | |
| -</span><span class="marked1"><a name="line39"></a> 39 @options.freeze | |
| -</span><span class="inferred0"><a name="line40"></a> 40 end | |
| -</span><span class="inferred1"><a name="line41"></a> 41 | |
| -</span><span class="inferred0"><a name="line42"></a> 42 # Runs the repor… | |
| -</span><span class="inferred1"><a name="line43"></a> 43 # | |
| -</span><span class="inferred0"><a name="line44"></a> 44 # ==== Options | |
| -</span><span class="inferred1"><a name="line45"></a> 45 # * <tt>:l… | |
| -</span><span class="inferred0"><a name="line46"></a> 46 # * <tt>:c… | |
| -</span><span class="inferred1"><a name="line47"></a> 47 # * <tt>:g… | |
| -</span><span class="inferred0"><a name="line48"></a> 48 # * <tt>:l… | |
| -</span><span class="inferred1"><a name="line49"></a> 49 # * <tt>:e… | |
| -</span><span class="marked0"><a name="line50"></a> 50 def run(options = … | |
| -</span><span class="marked1"><a name="line51"></a> 51 custom_condition… | |
| -</span><span class="marked0"><a name="line52"></a> 52 options = option… | |
| -</span><span class="marked1"><a name="line53"></a> 53 ReportCache.proc… | |
| -</span><span class="marked0"><a name="line54"></a> 54 read_data(begi… | |
| -</span><span class="inferred1"><a name="line55"></a> 55 end | |
| -</span><span class="inferred0"><a name="line56"></a> 56 end | |
| -</span><span class="inferred1"><a name="line57"></a> 57 | |
| -</span><span class="marked0"><a name="line58"></a> 58 private | |
| -</span><span class="inferred1"><a name="line59"></a> 59 | |
| -</span><span class="marked0"><a name="line60"></a> 60 def options_for_… | |
| -</span><span class="marked1"><a name="line61"></a> 61 options = opti… | |
| -</span><span class="marked0"><a name="line62"></a> 62 ensure_valid_o… | |
| -</span><span class="marked1"><a name="line63"></a> 63 options.revers… | |
| -</span><span class="marked0"><a name="line64"></a> 64 options[:group… | |
| -</span><span class="marked1"><a name="line65"></a> 65 return options | |
| -</span><span class="inferred0"><a name="line66"></a> 66 end | |
| -</span><span class="inferred1"><a name="line67"></a> 67 | |
| -</span><span class="marked0"><a name="line68"></a> 68 def read_data(be… | |
| -</span><span class="marked1"><a name="line69"></a> 69 conditions = s… | |
| -</span><span class="marked0"><a name="line70"></a> 70 @klass.send(@a… | |
| -</span><span class="inferred1"><a name="line71"></a> 71 @value_col… | |
| -</span><span class="inferred0"><a name="line72"></a> 72 :condition… | |
| -</span><span class="marked1"><a name="line73"></a> 73 :group =>… | |
| -</span><span class="marked0"><a name="line74"></a> 74 :order =>… | |
| -</span><span class="inferred1"><a name="line75"></a> 75 ) | |
| -</span><span class="inferred0"><a name="line76"></a> 76 end | |
| -</span><span class="inferred1"><a name="line77"></a> 77 | |
| -</span><span class="marked0"><a name="line78"></a> 78 def setup_condit… | |
| -</span><span class="marked1"><a name="line79"></a> 79 conditions = [… | |
| -</span><span class="marked0"><a name="line80"></a> 80 conditions[0] … | |
| -</span><span class="marked1"><a name="line81"></a> 81 conditions[0] … | |
| -</span><span class="marked0"><a name="line82"></a> 82 'BETWEEN ? A… | |
| -</span><span class="marked1"><a name="line83"></a> 83 elsif begin_at | |
| -</span><span class="marked0"><a name="line84"></a> 84 '>= ?' | |
| -</span><span class="marked1"><a name="line85"></a> 85 elsif end_at | |
| -</span><span class="marked0"><a name="line86"></a> 86 '<= ?' | |
| -</span><span class="inferred1"><a name="line87"></a> 87 else | |
| -</span><span class="marked0"><a name="line88"></a> 88 raise Argume… | |
| -</span><span class="inferred1"><a name="line89"></a> 89 end | |
| -</span><span class="marked0"><a name="line90"></a> 90 conditions <… | |
| -</span><span class="marked1"><a name="line91"></a> 91 conditions <… | |
| -</span><span class="marked0"><a name="line92"></a> 92 conditions | |
| -</span><span class="inferred1"><a name="line93"></a> 93 end | |
| -</span><span class="inferred0"><a name="line94"></a> 94 | |
| -</span><span class="marked1"><a name="line95"></a> 95 def ensure_valid… | |
| -</span><span class="marked0"><a name="line96"></a> 96 case context | |
| -</span><span class="marked1"><a name="line97"></a> 97 when :initia… | |
| -</span><span class="marked0"><a name="line98"></a> 98 options.ea… | |
| -</span><span class="marked1"><a name="line99"></a> 99 raise Ar… | |
| -</span><span class="inferred0"><a name="line100"></a>100 end | |
| -</span><span class="marked1"><a name="line101"></a>101 raise Arg… | |
| -</span><span class="marked0"><a name="line102"></a>102 raise Arg… | |
| -</span><span class="marked1"><a name="line103"></a>103 when :run | |
| -</span><span class="marked0"><a name="line104"></a>104 options.e… | |
| -</span><span class="marked1"><a name="line105"></a>105 raise A… | |
| -</span><span class="inferred0"><a name="line106"></a>106 end | |
| -</span><span class="inferred1"><a name="line107"></a>107 end | |
| -</span><span class="marked0"><a name="line108"></a>108 raise Argumen… | |
| -</span><span class="marked1"><a name="line109"></a>109 raise Argumen… | |
| -</span><span class="marked0"><a name="line110"></a>110 raise Argumen… | |
| -</span><span class="marked1"><a name="line111"></a>111 raise Argumen… | |
| -</span><span class="marked0"><a name="line112"></a>112 raise Argumen… | |
| -</span><span class="inferred1"><a name="line113"></a>113 end | |
| -</span><span class="inferred0"><a name="line114"></a>114 | |
| -</span><span class="inferred1"><a name="line115"></a>115 end | |
| -</span><span class="inferred0"><a name="line116"></a>116 | |
| -</span><span class="inferred1"><a name="line117"></a>117 end | |
| -</span><span class="inferred0"><a name="line118"></a>118 | |
| -</span><span class="inferred1"><a name="line119"></a>119 end | |
| +<pre><span class="marked0"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| +</span><span class="inferred1"><a name="line2"></a> 2 | |
| +</span><span class="marked0"><a name="line3"></a> 3 module ReportsAsSparkli… | |
| +</span><span class="inferred1"><a name="line4"></a> 4 | |
| +</span><span class="inferred0"><a name="line5"></a> 5 # The Report class … | |
| +</span><span class="marked1"><a name="line6"></a> 6 class Report | |
| +</span><span class="inferred0"><a name="line7"></a> 7 | |
| +</span><span class="marked1"><a name="line8"></a> 8 attr_reader :klass,… | |
| +</span><span class="inferred0"><a name="line9"></a> 9 | |
| +</span><span class="inferred1"><a name="line10"></a> 10 # ==== Parameters | |
| +</span><span class="inferred0"><a name="line11"></a> 11 # * <tt>kl… | |
| +</span><span class="inferred1"><a name="line12"></a> 12 # * <tt>na… | |
| +</span><span class="inferred0"><a name="line13"></a> 13 # | |
| +</span><span class="inferred1"><a name="line14"></a> 14 # ==== Options | |
| +</span><span class="inferred0"><a name="line15"></a> 15 # | |
| +</span><span class="inferred1"><a name="line16"></a> 16 # * <tt>:d… | |
| +</span><span class="inferred0"><a name="line17"></a> 17 # * <tt>:v… | |
| +</span><span class="inferred1"><a name="line18"></a> 18 # * <tt>:a… | |
| +</span><span class="inferred0"><a name="line19"></a> 19 # * <tt>:g… | |
| +</span><span class="inferred1"><a name="line20"></a> 20 # * <tt>:l… | |
| +</span><span class="inferred0"><a name="line21"></a> 21 # * <tt>:c… | |
| +</span><span class="inferred1"><a name="line22"></a> 22 # * <tt>:l… | |
| +</span><span class="inferred0"><a name="line23"></a> 23 # * <tt>:e… | |
| +</span><span class="marked1"><a name="line24"></a> 24 def initialize(kla… | |
| +</span><span class="marked0"><a name="line25"></a> 25 ensure_valid_opt… | |
| +</span><span class="marked1"><a name="line26"></a> 26 @klass = … | |
| +</span><span class="marked0"><a name="line27"></a> 27 @name = … | |
| +</span><span class="marked1"><a name="line28"></a> 28 @date_column = … | |
| +</span><span class="marked0"><a name="line29"></a> 29 @aggregation = … | |
| +</span><span class="marked1"><a name="line30"></a> 30 @value_column = … | |
| +</span><span class="marked0"><a name="line31"></a> 31 @options = { | |
| +</span><span class="inferred1"><a name="line32"></a> 32 :limit … | |
| +</span><span class="inferred0"><a name="line33"></a> 33 :conditions … | |
| +</span><span class="marked1"><a name="line34"></a> 34 :grouping =&… | |
| +</span><span class="inferred0"><a name="line35"></a> 35 :live_data … | |
| +</span><span class="inferred1"><a name="line36"></a> 36 :end_date … | |
| +</span><span class="inferred0"><a name="line37"></a> 37 } | |
| +</span><span class="marked1"><a name="line38"></a> 38 @options.merge!(… | |
| +</span><span class="marked0"><a name="line39"></a> 39 @options.freeze | |
| +</span><span class="inferred1"><a name="line40"></a> 40 end | |
| +</span><span class="inferred0"><a name="line41"></a> 41 | |
| +</span><span class="inferred1"><a name="line42"></a> 42 # Runs the repor… | |
| +</span><span class="inferred0"><a name="line43"></a> 43 # | |
| +</span><span class="inferred1"><a name="line44"></a> 44 # ==== Options | |
| +</span><span class="inferred0"><a name="line45"></a> 45 # * <tt>:g… | |
| +</span><span class="inferred1"><a name="line46"></a> 46 # * <tt>:l… | |
| +</span><span class="inferred0"><a name="line47"></a> 47 # * <tt>:c… | |
| +</span><span class="inferred1"><a name="line48"></a> 48 # * <tt>:l… | |
| +</span><span class="inferred0"><a name="line49"></a> 49 # * <tt>:e… | |
| +</span><span class="marked1"><a name="line50"></a> 50 def run(options = … | |
| +</span><span class="marked0"><a name="line51"></a> 51 custom_condition… | |
| +</span><span class="marked1"><a name="line52"></a> 52 options = option… | |
| +</span><span class="marked0"><a name="line53"></a> 53 ReportCache.proc… | |
| +</span><span class="marked1"><a name="line54"></a> 54 read_data(begi… | |
| +</span><span class="inferred0"><a name="line55"></a> 55 end | |
| +</span><span class="inferred1"><a name="line56"></a> 56 end | |
| +</span><span class="inferred0"><a name="line57"></a> 57 | |
| +</span><span class="marked1"><a name="line58"></a> 58 private | |
| +</span><span class="inferred0"><a name="line59"></a> 59 | |
| +</span><span class="marked1"><a name="line60"></a> 60 def options_for_… | |
| +</span><span class="marked0"><a name="line61"></a> 61 options = opti… | |
| +</span><span class="marked1"><a name="line62"></a> 62 ensure_valid_o… | |
| +</span><span class="marked0"><a name="line63"></a> 63 options.revers… | |
| +</span><span class="marked1"><a name="line64"></a> 64 options[:group… | |
| +</span><span class="marked0"><a name="line65"></a> 65 return options | |
| +</span><span class="inferred1"><a name="line66"></a> 66 end | |
| +</span><span class="inferred0"><a name="line67"></a> 67 | |
| +</span><span class="marked1"><a name="line68"></a> 68 def read_data(be… | |
| +</span><span class="marked0"><a name="line69"></a> 69 conditions = s… | |
| +</span><span class="marked1"><a name="line70"></a> 70 @klass.send(@a… | |
| +</span><span class="inferred0"><a name="line71"></a> 71 @value_col… | |
| +</span><span class="inferred1"><a name="line72"></a> 72 :condition… | |
| +</span><span class="marked0"><a name="line73"></a> 73 :group =>… | |
| +</span><span class="marked1"><a name="line74"></a> 74 :order =>… | |
| +</span><span class="inferred0"><a name="line75"></a> 75 ) | |
| +</span><span class="inferred1"><a name="line76"></a> 76 end | |
| +</span><span class="inferred0"><a name="line77"></a> 77 | |
| +</span><span class="marked1"><a name="line78"></a> 78 def setup_condit… | |
| +</span><span class="marked0"><a name="line79"></a> 79 conditions = [… | |
| +</span><span class="marked1"><a name="line80"></a> 80 conditions[0] … | |
| +</span><span class="marked0"><a name="line81"></a> 81 conditions[0] … | |
| +</span><span class="marked1"><a name="line82"></a> 82 'BETWEEN ? A… | |
| +</span><span class="marked0"><a name="line83"></a> 83 elsif begin_at | |
| +</span><span class="marked1"><a name="line84"></a> 84 '>= ?' | |
| +</span><span class="marked0"><a name="line85"></a> 85 elsif end_at | |
| +</span><span class="marked1"><a name="line86"></a> 86 '<= ?' | |
| +</span><span class="inferred0"><a name="line87"></a> 87 else | |
| +</span><span class="marked1"><a name="line88"></a> 88 raise Argume… | |
| +</span><span class="inferred0"><a name="line89"></a> 89 end | |
| +</span><span class="marked1"><a name="line90"></a> 90 conditions <… | |
| +</span><span class="marked0"><a name="line91"></a> 91 conditions <… | |
| +</span><span class="marked1"><a name="line92"></a> 92 conditions | |
| +</span><span class="inferred0"><a name="line93"></a> 93 end | |
| +</span><span class="inferred1"><a name="line94"></a> 94 | |
| +</span><span class="marked0"><a name="line95"></a> 95 def ensure_valid… | |
| +</span><span class="marked1"><a name="line96"></a> 96 case context | |
| +</span><span class="marked0"><a name="line97"></a> 97 when :initia… | |
| +</span><span class="marked1"><a name="line98"></a> 98 options.ea… | |
| +</span><span class="marked0"><a name="line99"></a> 99 raise Ar… | |
| +</span><span class="inferred1"><a name="line100"></a>100 end | |
| +</span><span class="marked0"><a name="line101"></a>101 raise Arg… | |
| +</span><span class="marked1"><a name="line102"></a>102 raise Arg… | |
| +</span><span class="marked0"><a name="line103"></a>103 when :run | |
| +</span><span class="marked1"><a name="line104"></a>104 options.e… | |
| +</span><span class="marked0"><a name="line105"></a>105 raise A… | |
| +</span><span class="inferred1"><a name="line106"></a>106 end | |
| +</span><span class="inferred0"><a name="line107"></a>107 end | |
| +</span><span class="marked1"><a name="line108"></a>108 raise Argumen… | |
| +</span><span class="marked0"><a name="line109"></a>109 raise Argumen… | |
| +</span><span class="marked1"><a name="line110"></a>110 raise Argumen… | |
| +</span><span class="marked0"><a name="line111"></a>111 raise Argumen… | |
| +</span><span class="marked1"><a name="line112"></a>112 raise Argumen… | |
| +</span><span class="inferred0"><a name="line113"></a>113 end | |
| +</span><span class="inferred1"><a name="line114"></a>114 | |
| +</span><span class="inferred0"><a name="line115"></a>115 end | |
| +</span><span class="inferred1"><a name="line116"></a>116 | |
| +</span><span class="inferred0"><a name="line117"></a>117 end | |
| +</span><span class="inferred1"><a name="line118"></a>118 | |
| +</span><span class="inferred0"><a name="line119"></a>119 end | |
| </span></pre><hr/> | |
| <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov c… | |
| version 0.8.1.2.</p> | |
| diff --git a/doc/coverage/lib-simplabs-reports_as_sparkline-reporting_period_rb… | |
| @@ -553,7 +553,7 @@ span.run100 { | |
| </style> | |
| </head> | |
| <body><h3>C0 code coverage information</h3> | |
| - <p>Generated on Wed Apr 29 18:53:08 +0200 2009 with <a href='http://eigenc… | |
| + <p>Generated on Wed Apr 29 19:33:53 +0200 2009 with <a href='http://eigenc… | |
| </p> | |
| <hr/> | |
| <pre><span class='marked0'>Code reported as executed by Ruby looks like th… | |
| @@ -571,11 +571,11 @@ span.run100 { | |
| </thead> | |
| <tbody><tr class='light'><td><a href='lib-simplabs-reports_as_sparkline-repo… | |
| </td> | |
| - <td class='lines_total'><tt>108</tt> | |
| + <td class='lines_total'><tt>93</tt> | |
| </td> | |
| <td class='lines_code'><tt>76</tt> | |
| </td> | |
| - <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt cla… | |
| + <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt cla… | |
| </td> | |
| <td><table cellspacing='0' class='percent_graph' cellpadding='0' w… | |
| <td class='uncovered' width='4'/> | |
| @@ -598,114 +598,99 @@ span.run100 { | |
| </tr> | |
| </tbody> | |
| </table> | |
| -<pre><span class="marked0"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| -</span><span class="inferred1"><a name="line2"></a> 2 | |
| -</span><span class="marked0"><a name="line3"></a> 3 module ReportsAsSparkli… | |
| -</span><span class="inferred1"><a name="line4"></a> 4 | |
| -</span><span class="inferred0"><a name="line5"></a> 5 # A ReportingPeriod… | |
| -</span><span class="marked1"><a name="line6"></a> 6 class ReportingPeriod | |
| -</span><span class="inferred0"><a name="line7"></a> 7 | |
| -</span><span class="marked1"><a name="line8"></a> 8 attr_reader :date_t… | |
| -</span><span class="inferred0"><a name="line9"></a> 9 | |
| -</span><span class="inferred1"><a name="line10"></a> 10 # ==== Parameters | |
| -</span><span class="inferred0"><a name="line11"></a> 11 # * <tt>gr… | |
| -</span><span class="inferred1"><a name="line12"></a> 12 # * <tt>da… | |
| -</span><span class="marked0"><a name="line13"></a> 13 def initialize(gro… | |
| -</span><span class="marked1"><a name="line14"></a> 14 @grouping = gro… | |
| -</span><span class="marked0"><a name="line15"></a> 15 @date_time = par… | |
| -</span><span class="inferred1"><a name="line16"></a> 16 end | |
| -</span><span class="inferred0"><a name="line17"></a> 17 | |
| -</span><span class="inferred1"><a name="line18"></a> 18 # Returns the fi… | |
| -</span><span class="inferred0"><a name="line19"></a> 19 # | |
| -</span><span class="inferred1"><a name="line20"></a> 20 # ==== Parameters | |
| -</span><span class="inferred0"><a name="line21"></a> 21 # * <tt>gr… | |
| -</span><span class="inferred1"><a name="line22"></a> 22 # * <tt>li… | |
| -</span><span class="marked0"><a name="line23"></a> 23 def self.first(gro… | |
| -</span><span class="marked1"><a name="line24"></a> 24 self.new(groupin… | |
| -</span><span class="marked0"><a name="line25"></a> 25 end | |
| -</span><span class="inferred1"><a name="line26"></a> 26 | |
| -</span><span class="marked0"><a name="line27"></a> 27 def self.from_db_s… | |
| -</span><span class="marked1"><a name="line28"></a> 28 parts = grouping… | |
| -</span><span class="marked0"><a name="line29"></a> 29 result = case gr… | |
| -</span><span class="marked1"><a name="line30"></a> 30 when :hour | |
| -</span><span class="marked0"><a name="line31"></a> 31 self.new(gro… | |
| -</span><span class="marked1"><a name="line32"></a> 32 when :day | |
| -</span><span class="marked0"><a name="line33"></a> 33 self.new(gro… | |
| -</span><span class="marked1"><a name="line34"></a> 34 when :week | |
| -</span><span class="marked0"><a name="line35"></a> 35 self.new(gro… | |
| -</span><span class="marked1"><a name="line36"></a> 36 when :month | |
| -</span><span class="marked0"><a name="line37"></a> 37 self.new(gro… | |
| -</span><span class="inferred1"><a name="line38"></a> 38 end | |
| -</span><span class="marked0"><a name="line39"></a> 39 result | |
| -</span><span class="inferred1"><a name="line40"></a> 40 end | |
| -</span><span class="inferred0"><a name="line41"></a> 41 | |
| -</span><span class="inferred1"><a name="line42"></a> 42 # Returns the ne… | |
| -</span><span class="marked0"><a name="line43"></a> 43 def next | |
| -</span><span class="marked1"><a name="line44"></a> 44 self.offset(1) | |
| -</span><span class="marked0"><a name="line45"></a> 45 end | |
| -</span><span class="inferred1"><a name="line46"></a> 46 | |
| -</span><span class="inferred0"><a name="line47"></a> 47 # Returns the pr… | |
| -</span><span class="marked1"><a name="line48"></a> 48 def previous | |
| -</span><span class="marked0"><a name="line49"></a> 49 self.offset(-1) | |
| -</span><span class="marked1"><a name="line50"></a> 50 end | |
| -</span><span class="inferred0"><a name="line51"></a> 51 | |
| -</span><span class="inferred1"><a name="line52"></a> 52 # Returns the re… | |
| -</span><span class="inferred0"><a name="line53"></a> 53 # | |
| -</span><span class="inferred1"><a name="line54"></a> 54 # ==== Parameters | |
| -</span><span class="inferred0"><a name="line55"></a> 55 # * <tt>of… | |
| -</span><span class="marked1"><a name="line56"></a> 56 def offset(offset) | |
| -</span><span class="marked0"><a name="line57"></a> 57 self.class.new(@… | |
| -</span><span class="marked1"><a name="line58"></a> 58 end | |
| -</span><span class="inferred0"><a name="line59"></a> 59 | |
| -</span><span class="marked1"><a name="line60"></a> 60 def ==(other) #:no… | |
| -</span><span class="marked0"><a name="line61"></a> 61 if other.class =… | |
| -</span><span class="marked1"><a name="line62"></a> 62 return @date_t… | |
| -</span><span class="inferred0"><a name="line63"></a> 63 end | |
| -</span><span class="uncovered1"><a name="line64"></a> 64 false | |
| -</span><span class="uncovered0"><a name="line65"></a> 65 end | |
| -</span><span class="inferred1"><a name="line66"></a> 66 | |
| -</span><span class="marked0"><a name="line67"></a> 67 def <(other) #:… | |
| -</span><span class="marked1"><a name="line68"></a> 68 if other.class =… | |
| -</span><span class="marked0"><a name="line69"></a> 69 return @date_t… | |
| -</span><span class="inferred1"><a name="line70"></a> 70 end | |
| -</span><span class="uncovered0"><a name="line71"></a> 71 raise Argumen… | |
| -</span><span class="uncovered1"><a name="line72"></a> 72 end | |
| -</span><span class="inferred0"><a name="line73"></a> 73 | |
| -</span><span class="marked1"><a name="line74"></a> 74 def last_date_time… | |
| -</span><span class="marked0"><a name="line75"></a> 75 case @grouping.i… | |
| -</span><span class="marked1"><a name="line76"></a> 76 when :hour | |
| -</span><span class="marked0"><a name="line77"></a> 77 DateTime.new… | |
| -</span><span class="marked1"><a name="line78"></a> 78 when :day | |
| -</span><span class="marked0"><a name="line79"></a> 79 DateTime.new… | |
| -</span><span class="marked1"><a name="line80"></a> 80 when :week | |
| -</span><span class="marked0"><a name="line81"></a> 81 date_time = … | |
| -</span><span class="marked1"><a name="line82"></a> 82 Date.new(dat… | |
| -</span><span class="marked0"><a name="line83"></a> 83 when :month | |
| -</span><span class="marked1"><a name="line84"></a> 84 Date.new(@da… | |
| -</span><span class="inferred0"><a name="line85"></a> 85 end | |
| -</span><span class="marked1"><a name="line86"></a> 86 end | |
| -</span><span class="inferred0"><a name="line87"></a> 87 | |
| -</span><span class="marked1"><a name="line88"></a> 88 private | |
| -</span><span class="inferred0"><a name="line89"></a> 89 | |
| -</span><span class="marked1"><a name="line90"></a> 90 def parse_date_t… | |
| -</span><span class="marked0"><a name="line91"></a> 91 case @grouping… | |
| -</span><span class="marked1"><a name="line92"></a> 92 when :hour | |
| -</span><span class="marked0"><a name="line93"></a> 93 DateTime.n… | |
| -</span><span class="marked1"><a name="line94"></a> 94 when :day | |
| -</span><span class="marked0"><a name="line95"></a> 95 date_time.… | |
| -</span><span class="marked1"><a name="line96"></a> 96 when :week | |
| -</span><span class="marked0"><a name="line97"></a> 97 date_time … | |
| -</span><span class="marked1"><a name="line98"></a> 98 Date.new(d… | |
| -</span><span class="marked0"><a name="line99"></a> 99 when :month | |
| -</span><span class="marked1"><a name="line100"></a>100 Date.new(… | |
| -</span><span class="inferred0"><a name="line101"></a>101 end | |
| -</span><span class="marked1"><a name="line102"></a>102 end | |
| -</span><span class="inferred0"><a name="line103"></a>103 | |
| -</span><span class="inferred1"><a name="line104"></a>104 end | |
| -</span><span class="inferred0"><a name="line105"></a>105 | |
| -</span><span class="inferred1"><a name="line106"></a>106 end | |
| -</span><span class="inferred0"><a name="line107"></a>107 | |
| -</span><span class="inferred1"><a name="line108"></a>108 end | |
| +<pre><span class="marked1"><a name="line1"></a> 1 module Simplabs #:nodoc: | |
| +</span><span class="inferred0"><a name="line2"></a> 2 | |
| +</span><span class="marked1"><a name="line3"></a> 3 module ReportsAsSparklin… | |
| +</span><span class="inferred0"><a name="line4"></a> 4 | |
| +</span><span class="marked1"><a name="line5"></a> 5 class ReportingPeriod … | |
| +</span><span class="inferred0"><a name="line6"></a> 6 | |
| +</span><span class="marked1"><a name="line7"></a> 7 attr_reader :date_ti… | |
| +</span><span class="inferred0"><a name="line8"></a> 8 | |
| +</span><span class="marked1"><a name="line9"></a> 9 def initialize(group… | |
| +</span><span class="marked0"><a name="line10"></a>10 @grouping = grou… | |
| +</span><span class="marked1"><a name="line11"></a>11 @date_time = pars… | |
| +</span><span class="inferred0"><a name="line12"></a>12 end | |
| +</span><span class="inferred1"><a name="line13"></a>13 | |
| +</span><span class="marked0"><a name="line14"></a>14 def self.first(grou… | |
| +</span><span class="marked1"><a name="line15"></a>15 self.new(grouping… | |
| +</span><span class="marked0"><a name="line16"></a>16 end | |
| +</span><span class="inferred1"><a name="line17"></a>17 | |
| +</span><span class="marked0"><a name="line18"></a>18 def self.from_db_st… | |
| +</span><span class="marked1"><a name="line19"></a>19 parts = grouping.… | |
| +</span><span class="marked0"><a name="line20"></a>20 result = case gro… | |
| +</span><span class="marked1"><a name="line21"></a>21 when :hour | |
| +</span><span class="marked0"><a name="line22"></a>22 self.new(grou… | |
| +</span><span class="marked1"><a name="line23"></a>23 when :day | |
| +</span><span class="marked0"><a name="line24"></a>24 self.new(grou… | |
| +</span><span class="marked1"><a name="line25"></a>25 when :week | |
| +</span><span class="marked0"><a name="line26"></a>26 self.new(grou… | |
| +</span><span class="marked1"><a name="line27"></a>27 when :month | |
| +</span><span class="marked0"><a name="line28"></a>28 self.new(grou… | |
| +</span><span class="inferred1"><a name="line29"></a>29 end | |
| +</span><span class="marked0"><a name="line30"></a>30 result | |
| +</span><span class="inferred1"><a name="line31"></a>31 end | |
| +</span><span class="inferred0"><a name="line32"></a>32 | |
| +</span><span class="marked1"><a name="line33"></a>33 def next | |
| +</span><span class="marked0"><a name="line34"></a>34 self.offset(1) | |
| +</span><span class="marked1"><a name="line35"></a>35 end | |
| +</span><span class="inferred0"><a name="line36"></a>36 | |
| +</span><span class="marked1"><a name="line37"></a>37 def previous | |
| +</span><span class="marked0"><a name="line38"></a>38 self.offset(-1) | |
| +</span><span class="marked1"><a name="line39"></a>39 end | |
| +</span><span class="inferred0"><a name="line40"></a>40 | |
| +</span><span class="marked1"><a name="line41"></a>41 def offset(offset) | |
| +</span><span class="marked0"><a name="line42"></a>42 self.class.new(@g… | |
| +</span><span class="marked1"><a name="line43"></a>43 end | |
| +</span><span class="inferred0"><a name="line44"></a>44 | |
| +</span><span class="marked1"><a name="line45"></a>45 def ==(other) | |
| +</span><span class="marked0"><a name="line46"></a>46 if other.class ==… | |
| +</span><span class="marked1"><a name="line47"></a>47 return @date_ti… | |
| +</span><span class="inferred0"><a name="line48"></a>48 end | |
| +</span><span class="uncovered1"><a name="line49"></a>49 false | |
| +</span><span class="uncovered0"><a name="line50"></a>50 end | |
| +</span><span class="inferred1"><a name="line51"></a>51 | |
| +</span><span class="marked0"><a name="line52"></a>52 def <(other) | |
| +</span><span class="marked1"><a name="line53"></a>53 if other.class ==… | |
| +</span><span class="marked0"><a name="line54"></a>54 return @date_ti… | |
| +</span><span class="inferred1"><a name="line55"></a>55 end | |
| +</span><span class="uncovered0"><a name="line56"></a>56 raise Argument… | |
| +</span><span class="uncovered1"><a name="line57"></a>57 end | |
| +</span><span class="inferred0"><a name="line58"></a>58 | |
| +</span><span class="marked1"><a name="line59"></a>59 def last_date_time | |
| +</span><span class="marked0"><a name="line60"></a>60 case @grouping.id… | |
| +</span><span class="marked1"><a name="line61"></a>61 when :hour | |
| +</span><span class="marked0"><a name="line62"></a>62 DateTime.new(… | |
| +</span><span class="marked1"><a name="line63"></a>63 when :day | |
| +</span><span class="marked0"><a name="line64"></a>64 DateTime.new(… | |
| +</span><span class="marked1"><a name="line65"></a>65 when :week | |
| +</span><span class="marked0"><a name="line66"></a>66 date_time = (… | |
| +</span><span class="marked1"><a name="line67"></a>67 Date.new(date… | |
| +</span><span class="marked0"><a name="line68"></a>68 when :month | |
| +</span><span class="marked1"><a name="line69"></a>69 Date.new(@dat… | |
| +</span><span class="inferred0"><a name="line70"></a>70 end | |
| +</span><span class="marked1"><a name="line71"></a>71 end | |
| +</span><span class="inferred0"><a name="line72"></a>72 | |
| +</span><span class="marked1"><a name="line73"></a>73 private | |
| +</span><span class="inferred0"><a name="line74"></a>74 | |
| +</span><span class="marked1"><a name="line75"></a>75 def parse_date_ti… | |
| +</span><span class="marked0"><a name="line76"></a>76 case @grouping.… | |
| +</span><span class="marked1"><a name="line77"></a>77 when :hour | |
| +</span><span class="marked0"><a name="line78"></a>78 DateTime.ne… | |
| +</span><span class="marked1"><a name="line79"></a>79 when :day | |
| +</span><span class="marked0"><a name="line80"></a>80 date_time.t… | |
| +</span><span class="marked1"><a name="line81"></a>81 when :week | |
| +</span><span class="marked0"><a name="line82"></a>82 date_time =… | |
| +</span><span class="marked1"><a name="line83"></a>83 Date.new(da… | |
| +</span><span class="marked0"><a name="line84"></a>84 when :month | |
| +</span><span class="marked1"><a name="line85"></a>85 Date.new(da… | |
| +</span><span class="inferred0"><a name="line86"></a>86 end | |
| +</span><span class="marked1"><a name="line87"></a>87 end | |
| +</span><span class="inferred0"><a name="line88"></a>88 | |
| +</span><span class="inferred1"><a name="line89"></a>89 end | |
| +</span><span class="inferred0"><a name="line90"></a>90 | |
| +</span><span class="inferred1"><a name="line91"></a>91 end | |
| +</span><span class="inferred0"><a name="line92"></a>92 | |
| +</span><span class="inferred1"><a name="line93"></a>93 end | |
| </span></pre><hr/> | |
| <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov c… | |
| version 0.8.1.2.</p> | |
| diff --git a/doc/coverage/lib-simplabs-reports_as_sparkline-sparkline_tag_helpe… | |
| @@ -553,7 +553,7 @@ span.run100 { | |
| </style> | |
| </head> | |
| <body><h3>C0 code coverage information</h3> | |
| - <p>Generated on Wed Apr 29 18:53:08 +0200 2009 with <a href='http://eigenc… | |
| + <p>Generated on Wed Apr 29 19:33:53 +0200 2009 with <a href='http://eigenc… | |
| </p> | |
| <hr/> | |
| <pre><span class='marked0'>Code reported as executed by Ruby looks like th… | |
| @@ -608,7 +608,7 @@ span.run100 { | |
| </span><span class="inferred1"><a name="line8"></a> 8 # | |
| </span><span class="inferred0"><a name="line9"></a> 9 # ==== Parameters | |
| </span><span class="inferred1"><a name="line10"></a>10 # | |
| -</span><span class="inferred0"><a name="line11"></a>11 # * <tt>dat… | |
| +</span><span class="inferred0"><a name="line11"></a>11 # * <tt>dat… | |
| </span><span class="inferred1"><a name="line12"></a>12 # | |
| </span><span class="inferred0"><a name="line13"></a>13 # ==== Options | |
| </span><span class="inferred1"><a name="line14"></a>14 # | |
| @@ -616,10 +616,10 @@ span.run100 { | |
| </span><span class="inferred1"><a name="line16"></a>16 # * <tt>hei… | |
| </span><span class="inferred0"><a name="line17"></a>17 # * <tt>lin… | |
| </span><span class="inferred1"><a name="line18"></a>18 # * <tt>fil… | |
| -</span><span class="inferred0"><a name="line19"></a>19 # * <tt>lab… | |
| +</span><span class="inferred0"><a name="line19"></a>19 # * <tt>lab… | |
| </span><span class="inferred1"><a name="line20"></a>20 # | |
| </span><span class="inferred0"><a name="line21"></a>21 # ==== Example | |
| -</span><span class="inferred1"><a name="line22"></a>22 # <%= sparklin… | |
| +</span><span class="inferred1"><a name="line22"></a>22 # <tt><%… | |
| </span><span class="marked0"><a name="line23"></a>23 def sparkline_tag(d… | |
| </span><span class="marked1"><a name="line24"></a>24 options.reverse_m… | |
| </span><span class="marked0"><a name="line25"></a>25 data = data.colle… | |
| diff --git a/doc/coverage/lib-simplabs-reports_as_sparkline_rb.html b/doc/cover… | |
| @@ -553,7 +553,7 @@ span.run100 { | |
| </style> | |
| </head> | |
| <body><h3>C0 code coverage information</h3> | |
| - <p>Generated on Wed Apr 29 18:53:07 +0200 2009 with <a href='http://eigenc… | |
| + <p>Generated on Wed Apr 29 19:33:53 +0200 2009 with <a href='http://eigenc… | |
| </p> | |
| <hr/> | |
| <pre><span class='marked0'>Code reported as executed by Ruby looks like th… | |
| @@ -571,7 +571,7 @@ span.run100 { | |
| </thead> | |
| <tbody><tr class='light'><td><a href='lib-simplabs-reports_as_sparkline_rb.h… | |
| </td> | |
| - <td class='lines_total'><tt>58</tt> | |
| + <td class='lines_total'><tt>59</tt> | |
| </td> | |
| <td class='lines_code'><tt>22</tt> | |
| </td> | |
| @@ -608,22 +608,22 @@ span.run100 { | |
| </span><span class="inferred0"><a name="line8"></a> 8 | |
| </span><span class="marked1"><a name="line9"></a> 9 module ClassMethods | |
| </span><span class="inferred0"><a name="line10"></a>10 | |
| -</span><span class="inferred1"><a name="line11"></a>11 # Generates a rep… | |
| +</span><span class="inferred1"><a name="line11"></a>11 # Generates a rep… | |
| </span><span class="inferred0"><a name="line12"></a>12 # | |
| </span><span class="inferred1"><a name="line13"></a>13 # ==== Parameters | |
| </span><span class="inferred0"><a name="line14"></a>14 # | |
| -</span><span class="inferred1"><a name="line15"></a>15 # * <tt>nam… | |
| +</span><span class="inferred1"><a name="line15"></a>15 # * <tt>nam… | |
| </span><span class="inferred0"><a name="line16"></a>16 # | |
| </span><span class="inferred1"><a name="line17"></a>17 # ==== Options | |
| </span><span class="inferred0"><a name="line18"></a>18 # | |
| -</span><span class="inferred1"><a name="line19"></a>19 # * <tt>:da… | |
| -</span><span class="inferred0"><a name="line20"></a>20 # * <tt>:va… | |
| -</span><span class="inferred1"><a name="line21"></a>21 # * <tt>:ag… | |
| -</span><span class="inferred0"><a name="line22"></a>22 # * <tt>:gr… | |
| -</span><span class="inferred1"><a name="line23"></a>23 # * <tt>:li… | |
| -</span><span class="inferred0"><a name="line24"></a>24 # * <tt>:co… | |
| -</span><span class="inferred1"><a name="line25"></a>25 # * <tt>:li… | |
| -</span><span class="inferred0"><a name="line26"></a>26 # * <tt>:en… | |
| +</span><span class="inferred1"><a name="line19"></a>19 # * <tt>:da… | |
| +</span><span class="inferred0"><a name="line20"></a>20 # * <tt>:va… | |
| +</span><span class="inferred1"><a name="line21"></a>21 # * <tt>:ag… | |
| +</span><span class="inferred0"><a name="line22"></a>22 # * <tt>:gr… | |
| +</span><span class="inferred1"><a name="line23"></a>23 # * <tt>:li… | |
| +</span><span class="inferred0"><a name="line24"></a>24 # * <tt>:co… | |
| +</span><span class="inferred1"><a name="line25"></a>25 # * <tt>:li… | |
| +</span><span class="inferred0"><a name="line26"></a>26 # * <tt>:en… | |
| </span><span class="inferred1"><a name="line27"></a>27 # | |
| </span><span class="inferred0"><a name="line28"></a>28 # ==== Examples | |
| </span><span class="inferred1"><a name="line29"></a>29 # | |
| @@ -631,31 +631,32 @@ span.run100 { | |
| </span><span class="inferred1"><a name="line31"></a>31 # reports_as_s… | |
| </span><span class="inferred0"><a name="line32"></a>32 # reports_as_s… | |
| </span><span class="inferred1"><a name="line33"></a>33 # end | |
| -</span><span class="inferred0"><a name="line34"></a>34 # class User <… | |
| -</span><span class="inferred1"><a name="line35"></a>35 # reports_as_s… | |
| -</span><span class="inferred0"><a name="line36"></a>36 # reports_as_s… | |
| -</span><span class="inferred1"><a name="line37"></a>37 # reports_as_s… | |
| -</span><span class="inferred0"><a name="line38"></a>38 # reports_as_s… | |
| -</span><span class="inferred1"><a name="line39"></a>39 # end | |
| -</span><span class="marked0"><a name="line40"></a>40 def reports_as_spar… | |
| -</span><span class="marked1"><a name="line41"></a>41 (class << s… | |
| -</span><span class="marked0"><a name="line42"></a>42 define_method &… | |
| -</span><span class="marked1"><a name="line43"></a>43 if options.de… | |
| -</span><span class="uncovered0"><a name="line44"></a>44 report =… | |
| -</span><span class="inferred1"><a name="line45"></a>45 else | |
| -</span><span class="marked0"><a name="line46"></a>46 report = Si… | |
| -</span><span class="inferred1"><a name="line47"></a>47 end | |
| -</span><span class="marked0"><a name="line48"></a>48 raise Argumen… | |
| -</span><span class="marked1"><a name="line49"></a>49 report.run(ar… | |
| -</span><span class="inferred0"><a name="line50"></a>50 end | |
| -</span><span class="inferred1"><a name="line51"></a>51 end | |
| -</span><span class="marked0"><a name="line52"></a>52 end | |
| -</span><span class="inferred1"><a name="line53"></a>53 | |
| -</span><span class="inferred0"><a name="line54"></a>54 end | |
| -</span><span class="inferred1"><a name="line55"></a>55 | |
| -</span><span class="inferred0"><a name="line56"></a>56 end | |
| -</span><span class="inferred1"><a name="line57"></a>57 | |
| -</span><span class="inferred0"><a name="line58"></a>58 end | |
| +</span><span class="inferred0"><a name="line34"></a>34 # | |
| +</span><span class="inferred1"><a name="line35"></a>35 # class User <… | |
| +</span><span class="inferred0"><a name="line36"></a>36 # reports_as_s… | |
| +</span><span class="inferred1"><a name="line37"></a>37 # reports_as_s… | |
| +</span><span class="inferred0"><a name="line38"></a>38 # reports_as_s… | |
| +</span><span class="inferred1"><a name="line39"></a>39 # reports_as_s… | |
| +</span><span class="inferred0"><a name="line40"></a>40 # end | |
| +</span><span class="marked1"><a name="line41"></a>41 def reports_as_spar… | |
| +</span><span class="marked0"><a name="line42"></a>42 (class << s… | |
| +</span><span class="marked1"><a name="line43"></a>43 define_method &… | |
| +</span><span class="marked0"><a name="line44"></a>44 if options.de… | |
| +</span><span class="uncovered1"><a name="line45"></a>45 report =… | |
| +</span><span class="inferred0"><a name="line46"></a>46 else | |
| +</span><span class="marked1"><a name="line47"></a>47 report = Si… | |
| +</span><span class="inferred0"><a name="line48"></a>48 end | |
| +</span><span class="marked1"><a name="line49"></a>49 raise Argumen… | |
| +</span><span class="marked0"><a name="line50"></a>50 report.run(ar… | |
| +</span><span class="inferred1"><a name="line51"></a>51 end | |
| +</span><span class="inferred0"><a name="line52"></a>52 end | |
| +</span><span class="marked1"><a name="line53"></a>53 end | |
| +</span><span class="inferred0"><a name="line54"></a>54 | |
| +</span><span class="inferred1"><a name="line55"></a>55 end | |
| +</span><span class="inferred0"><a name="line56"></a>56 | |
| +</span><span class="inferred1"><a name="line57"></a>57 end | |
| +</span><span class="inferred0"><a name="line58"></a>58 | |
| +</span><span class="inferred1"><a name="line59"></a>59 end | |
| </span></pre><hr/> | |
| <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov c… | |
| version 0.8.1.2.</p> | |
| diff --git a/doc/created.rid b/doc/created.rid | |
| @@ -1 +1 @@ | |
| -Wed, 29 Apr 2009 18:52:13 +0200 | |
| +Wed, 29 Apr 2009 19:32:38 +0200 | |
| diff --git a/doc/files/README_rdoc.html b/doc/files/README_rdoc.html | |
| @@ -56,7 +56,7 @@ | |
| </tr> | |
| <tr class="top-aligned-row"> | |
| <td><strong>Last Update:</strong></td> | |
| - <td>Wed Apr 29 16:35:10 +0200 2009</td> | |
| + <td>Wed Apr 29 19:32:28 +0200 2009</td> | |
| </tr> | |
| </table> | |
| </div> | |
| @@ -71,7 +71,7 @@ | |
| <div id="description"> | |
| <h1>ReportsAsSparkline</h1> | |
| <p> | |
| -ReportsAsSparkline enables you to generate reports and sparklines from your | |
| +ReportsAsSparkline enables you to generate sparkline reports from your | |
| model‘s data with very little effort. | |
| </p> | |
| <h2>Usage</h2> | |
| @@ -81,42 +81,44 @@ If you hace a <tt>User</tt> model with <tt>created_at</tt> … | |
| <tt>reports_as_sparkline</tt> to it with the following options: | |
| </p> | |
| <ul> | |
| -<li>:date_column - The name of the date column on that the records are | |
| -aggregated | |
| +<li><tt>:date_column</tt> - The name of the date column over that the records | |
| +are aggregated (defaults to <tt>created_at</tt>) | |
| </li> | |
| -<li>:value_column - The name of the column that holds the value to sum for | |
| -aggregation :sum | |
| +<li><tt>:value_column</tt> - The name of the column that holds the values to | |
| +sum up when using aggregation <tt>:sum</tt> | |
| </li> | |
| -<li>:aggregation - The aggregation to use (one of :count, :sum, :minimum, | |
| -:maximum or :average); when using anything other than :count, :value_column | |
| -must also be specified (<b>If you really want to e.g. sumon the | |
| -‘id’ column, you have to explicitely say so.</b>) | |
| +<li><tt>:aggregation</tt> - The aggregation to use (one of <tt>:count</tt>, | |
| +<tt>:sum</tt>, <tt>:minimum</tt>, <tt>:maximum</tt> or <tt>:average</tt>); | |
| +when using anything other than <tt>:count</tt>, <tt>:value_column</tt> must | |
| +also be specified (<b>If you really want to e.g. sum up the values in the | |
| +<tt>id</tt> column, you have to explicitely say so.</b>); (defaults to | |
| +<tt>:count</tt>) | |
| </li> | |
| -<li>:grouping - The period records are grouped on (:hour, :day, :week, :month); | |
| -<b>Beware that reports_as_sparkline treats weeks as starting on monday!</b> | |
| +<li><tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, | |
| +<tt>:day</tt>, <tt>:week</tt>, <tt>:month</tt>); <b>Beware that | |
| +<tt>reports_as_sparkline</tt> treats weeks as starting on monday!</b> | |
| </li> | |
| -<li>:limit - The number of periods to get (see :grouping) | |
| +<li><tt>:limit</tt> - The number of reporting periods to get (see | |
| +<tt>:grouping</tt>), (defaults to 100) | |
| </li> | |
| -<li>:conditions - Conditions like in ActiveRecord::Base#find; only records that | |
| -match there conditions are reported on | |
| +<li><tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; | |
| +only records that match the conditions are reported; <b>Beware that when | |
| +conditions are specified, caching is disabled!</b> | |
| </li> | |
| -<li>:cumulate - Sets whether to cumulate the numbers (instead of [1, 2, 3] | |
| -returns [1, 3, 6]) | |
| +<li><tt>:live_data</tt> - Specifies whether data for the current reporting | |
| +period is to be read; <b>if <tt>:live_data</tt> is <tt>true</tt>, you will | |
| +experience a performance hit since the request cannot be satisfied from the | |
| +cache only (defaults to <tt>false</tt>)</b> | |
| </li> | |
| -<li>:live_data - Specified whether data for the current reporting period is | |
| -read; if :live_data is true, you will experience a performance hit since | |
| -the request cannot be satisfied from the cache only (defaults to false) | |
| - | |
| -</li> | |
| -<li>:end_date - When specified, the report will only include data for the | |
| -periods before this date. | |
| +<li><tt>:end_date</tt> - When specified, the report will only include data for | |
| +the <tt>:limit</tt> reporting periods until this date. | |
| </li> | |
| </ul> | |
| @@ -143,23 +145,28 @@ When invoking the report, you can override some of the op… | |
| specified for <tt>reports_as_sparkline</tt>: | |
| </p> | |
| <ul> | |
| -<li>:grouping - The period records are grouped on (:hour, :day, :week, :month) | |
| +<li><tt>:grouping</tt> - The period records are grouped on (<tt>:hour</tt>, | |
| +<tt>:day</tt>, <tt>:week</tt>, <tt>:month</tt>); <b>Beware that | |
| +<tt>reports_as_sparkline</tt> treats weeks as starting on monday!</b> | |
| </li> | |
| -<li>:limit - The number of periods to get (see :grouping) | |
| +<li><tt>:limit</tt> - The number of reporting periods to get (see | |
| +<tt>:grouping</tt>), (defaults to 100) | |
| </li> | |
| -<li>:conditions - Conditions like in ActiveRecord::Base#find; only records that | |
| -match there conditions are reported on | |
| +<li><tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#find</tt>; | |
| +only records that match the conditions are reported; <b>Beware that when | |
| +conditions are specified, caching is disabled!</b> | |
| </li> | |
| -<li>:live_data - Specified whether data for the current reporting period is | |
| -read; if :live_data is true, you will experience a performance hit since | |
| -the request cannot be satisfied from the cache only (defaults to false) | |
| +<li><tt>:live_data</tt> - Specifies whether data for the current reporting | |
| +period is to be read; <b>if <tt>:live_data</tt> is <tt>true</tt>, you will | |
| +experience a performance hit since the request cannot be satisfied from the | |
| +cache only (defaults to <tt>false</tt>)</b> | |
| </li> | |
| -<li>:end_date - When specified, the report will be for the periods before this | |
| -date. | |
| +<li><tt>:end_date</tt> - When specified, the report will only include data for | |
| +the <tt>:limit</tt> reporting periods until this date. | |
| </li> | |
| </ul> | |
| @@ -171,10 +178,6 @@ date. | |
| User.activations_report(:grouping => :week, :limit => 5) | |
| </pre> | |
| <p> | |
| -<b>Beware that when specifying conditions on invocation of the report, the | |
| -cache will not be used!</b> | |
| -</p> | |
| -<p> | |
| You can than render sparklines for these reports with sparkline_tag in your | |
| view: | |
| </p> | |
| @@ -185,20 +188,21 @@ view: | |
| The <tt>sparkline_tag</tt> helper takes the following parameters: | |
| </p> | |
| <ul> | |
| -<li>width - The width of the generated image | |
| +<li><tt>width</tt> - The width of the generated image | |
| </li> | |
| -<li>height - The height of the generated image | |
| +<li><tt>height</tt> - The height of the generated image | |
| </li> | |
| -<li>line_color - The line color of the sparkline (hex code) | |
| +<li><tt>line_color</tt> - The line color of the sparkline (hex code) | |
| </li> | |
| -<li>fill_color - The color to fill the area below the sparkline with (hex code) | |
| +<li><tt>fill_color</tt> - The color to fill the area below the sparkline with | |
| +(hex code) | |
| </li> | |
| -<li>labes - The axes to render lables for (Array of :x, :y, :r, :t; this is x | |
| -axis, y axis, right, top) | |
| +<li><tt>labels</tt> - The axes to render lables for (Array of <tt>:x</tt>, | |
| +<tt>:y+</tt>, <tt>:r</tt>, <tt>:t</tt>; this is x axis, y axis, right, top) | |
| </li> | |
| </ul> | |
| @@ -210,13 +214,13 @@ Installation requires 3 simple steps: | |
| <b>get the plugin</b> | |
| </p> | |
| <p> | |
| -From your RAILS_ROOT in Rails &gt;= 2.1, do | |
| +From your RAILS_ROOT in Rails >= 2.1, do | |
| </p> | |
| <pre> | |
| ./script/plugin install git://github.com/marcoow/reports_as_sparkline.git | |
| </pre> | |
| <p> | |
| -If you are on Rails &lt; 2.1, do this from your RAILS_ROOT | |
| +If you are on Rails < 2.1, do this from your RAILS_ROOT | |
| </p> | |
| <pre> | |
| git clone git://github.com/marcoow/reports_as_sparkline.git vendor/plugins/r… | |
| @@ -256,9 +260,6 @@ If you are on PostgreSQL, you should add functional indices: | |
| <li>support for Oracle and DB2 (and others?) missing | |
| </li> | |
| -<li>Implement data ranges in arguments | |
| - | |
| -</li> | |
| <li>Limit number of data points to maximum that the google chart api allows | |
| </li> | |
| @@ -280,8 +281,8 @@ href="http://github.com/myronmarston">github.com/myronmarst… | |
| <h2>Author</h2> | |
| <p> | |
| © 2008-2009 Marco Otte-Witte (<a | |
| -href="http://simplabs.com/#projects">simplabs.com/#projects</a>), Martin | |
| -Kavalar, released under the MIT license | |
| +href="http://simplabs.com">simplabs.com</a>), Martin Kavalar, released | |
| +under the MIT license | |
| </p> | |
| </div> | |
| diff --git a/doc/files/lib/simplabs/reports_as_sparkline/cumulated_report_rb.ht… | |
| @@ -56,7 +56,7 @@ | |
| </tr> | |
| <tr class="top-aligned-row"> | |
| <td><strong>Last Update:</strong></td> | |
| - <td>Wed Apr 29 10:44:16 +0200 2009</td> | |
| + <td>Wed Apr 29 19:28:16 +0200 2009</td> | |
| </tr> | |
| </table> | |
| </div> | |
| diff --git a/doc/files/lib/simplabs/reports_as_sparkline/grouping_rb.html b/doc… | |
| @@ -56,7 +56,7 @@ | |
| </tr> | |
| <tr class="top-aligned-row"> | |
| <td><strong>Last Update:</strong></td> | |
| - <td>Mon Apr 06 10:35:50 +0200 2009</td> | |
| + <td>Wed Apr 29 19:18:36 +0200 2009</td> | |
| </tr> | |
| </table> | |
| </div> | |
| diff --git a/doc/files/lib/simplabs/reports_as_sparkline/report_cache_rb.html b… | |
| @@ -56,7 +56,7 @@ | |
| </tr> | |
| <tr class="top-aligned-row"> | |
| <td><strong>Last Update:</strong></td> | |
| - <td>Wed Apr 29 18:14:28 +0200 2009</td> | |
| + <td>Wed Apr 29 19:20:49 +0200 2009</td> | |
| </tr> | |
| </table> | |
| </div> | |
| diff --git a/doc/files/lib/simplabs/reports_as_sparkline/report_rb.html b/doc/f… | |
| @@ -56,7 +56,7 @@ | |
| </tr> | |
| <tr class="top-aligned-row"> | |
| <td><strong>Last Update:</strong></td> | |
| - <td>Wed Apr 29 18:16:51 +0200 2009</td> | |
| + <td>Wed Apr 29 19:26:39 +0200 2009</td> | |
| </tr> | |
| </table> | |
| </div> | |
| diff --git a/doc/files/lib/simplabs/reports_as_sparkline/reporting_period_rb.ht… | |
| @@ -56,7 +56,7 @@ | |
| </tr> | |
| <tr class="top-aligned-row"> | |
| <td><strong>Last Update:</strong></td> | |
| - <td>Wed Apr 29 18:18:14 +0200 2009</td> | |
| + <td>Wed Apr 29 19:18:27 +0200 2009</td> | |
| </tr> | |
| </table> | |
| </div> | |
| diff --git a/doc/files/lib/simplabs/reports_as_sparkline/sparkline_tag_helper_r… | |
| @@ -56,7 +56,7 @@ | |
| </tr> | |
| <tr class="top-aligned-row"> | |
| <td><strong>Last Update:</strong></td> | |
| - <td>Mon Apr 06 10:35:50 +0200 2009</td> | |
| + <td>Wed Apr 29 19:28:41 +0200 2009</td> | |
| </tr> | |
| </table> | |
| </div> | |
| diff --git a/doc/files/lib/simplabs/reports_as_sparkline_rb.html b/doc/files/li… | |
| @@ -56,7 +56,7 @@ | |
| </tr> | |
| <tr class="top-aligned-row"> | |
| <td><strong>Last Update:</strong></td> | |
| - <td>Mon Apr 06 10:35:22 +0200 2009</td> | |
| + <td>Wed Apr 29 19:29:22 +0200 2009</td> | |
| </tr> | |
| </table> | |
| </div> | |
| diff --git a/doc/fr_class_index.html b/doc/fr_class_index.html | |
| @@ -22,9 +22,8 @@ | |
| <div id="index-entries"> | |
| <a href="classes/Simplabs/ReportsAsSparkline/ClassMethods.html">Simplabs::… | |
| <a href="classes/Simplabs/ReportsAsSparkline/CumulatedReport.html">Simplab… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/Grouping.html">Simplabs::Repo… | |
| <a href="classes/Simplabs/ReportsAsSparkline/Report.html">Simplabs::Report… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html">Simplab… | |
| + <a href="classes/Simplabs/ReportsAsSparkline/ReportCache.html">Simplabs::R… | |
| <a href="classes/Simplabs/ReportsAsSparkline/SparklineTagHelper.html">Simp… | |
| </div> | |
| </div> | |
| diff --git a/doc/fr_method_index.html b/doc/fr_method_index.html | |
| @@ -21,18 +21,11 @@ | |
| <h1 class="section-bar">Methods</h1> | |
| <div id="index-entries"> | |
| <a href="classes/Simplabs/ReportsAsSparkline/CumulatedReport.html#M000004"… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000009"… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/Grouping.html#M000007">identi… | |
| <a href="classes/Simplabs/ReportsAsSparkline/CumulatedReport.html#M000005"… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000008"… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/Grouping.html#M000006">new (S… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/Report.html#M000013">new (Sim… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000010"… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000012"… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000011"… | |
| + <a href="classes/Simplabs/ReportsAsSparkline/Report.html#M000006">new (Sim… | |
| <a href="classes/Simplabs/ReportsAsSparkline/ClassMethods.html#M000002">re… | |
| <a href="classes/Simplabs/ReportsAsSparkline/CumulatedReport.html#M000003"… | |
| - <a href="classes/Simplabs/ReportsAsSparkline/Report.html#M000014">run (Sim… | |
| + <a href="classes/Simplabs/ReportsAsSparkline/Report.html#M000007">run (Sim… | |
| <a href="classes/Simplabs/ReportsAsSparkline/SparklineTagHelper.html#M0000… | |
| </div> | |
| </div> | |
| diff --git a/doc/spec.html b/doc/spec.html | |
| @@ -1085,7 +1085,7 @@ a { | |
| <dd class="spec passed"><span class="passed_spec_name">should set the para… | |
| </dl> | |
| </div> | |
| -<script type="text/javascript">document.getElementById('duration').innerHTML =… | |
| +<script type="text/javascript">document.getElementById('duration').innerHTML =… | |
| <script type="text/javascript">document.getElementById('totals').innerHTML = "… | |
| </div> | |
| </div> | |
| diff --git a/lib/simplabs/reports_as_sparkline.rb b/lib/simplabs/reports_as_spa… | |
| @@ -8,22 +8,22 @@ module Simplabs #:nodoc: | |
| module ClassMethods | |
| - # Generates a report on a model. That report can then be executed via th… | |
| + # Generates a report on a model. That report can then be executed via th… | |
| # | |
| # ==== Parameters | |
| # | |
| - # * <tt>name</tt> - The name of the report, defines the name of the gene… | |
| + # * <tt>name</tt> - The name of the report, defines the name of the gene… | |
| # | |
| # ==== Options | |
| # | |
| - # * <tt>:date_column</tt> - The name of the date column on that the reco… | |
| - # * <tt>:value_column</tt> - The name of the column that holds the value… | |
| - # * <tt>:aggregation</tt> - The aggregation to use (one of :count, :sum,… | |
| - # * <tt>:grouping</tt> - The period records are grouped on (:hour, :day,… | |
| - # * <tt>:limit</tt> - The number of periods to get (see :grouping) | |
| - # * <tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; o… | |
| - # * <tt>:live_data</tt> - Specified whether data for the current reporti… | |
| - # * <tt>:end_date</tt> - When specified, the report will only include da… | |
| + # * <tt>:date_column</tt> - The name of the date column over that the re… | |
| + # * <tt>:value_column</tt> - The name of the column that holds the value… | |
| + # * <tt>:aggregation</tt> - The aggregation to use (one of <tt>:count</t… | |
| + # * <tt>:grouping</tt> - The period records are grouped on (<tt>:hour</t… | |
| + # * <tt>:limit</tt> - The number of reporting periods to get (see <tt>:g… | |
| + # * <tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#fin… | |
| + # * <tt>:live_data</tt> - Specifies whether data for the current reporti… | |
| + # * <tt>:end_date</tt> - When specified, the report will only include da… | |
| # | |
| # ==== Examples | |
| # | |
| @@ -31,6 +31,7 @@ module Simplabs #:nodoc: | |
| # reports_as_sparkline :games_per_day | |
| # reports_as_sparkline :games_played_total, :cumulate => true | |
| # end | |
| + # | |
| # class User < ActiveRecord::Base | |
| # reports_as_sparkline :registrations, :aggregation => :count | |
| # reports_as_sparkline :activations, :aggregation => :count, :date_… | |
| diff --git a/lib/simplabs/reports_as_sparkline/cumulated_report.rb b/lib/simpla… | |
| @@ -6,13 +6,13 @@ module Simplabs #:nodoc: | |
| # | |
| # ==== Examples | |
| # | |
| - # When Simplabs::ReportsAsSparkline::Report returns | |
| + # When Simplabs::ReportsAsSparkline::Report returns | |
| # | |
| - # [[<DateTime today>, 1], [<DateTime yesterday>, 2], etc.] | |
| + # [[<DateTime today>, 1], [<DateTime yesterday>, 2], etc.] | |
| # | |
| - # Simplabs::ReportsAsSparkline::CumulatedReport returns | |
| + # Simplabs::ReportsAsSparkline::CumulatedReport returns | |
| # | |
| - # [[<DateTime today>, 3], [<DateTime yesterday>, 2], etc.] | |
| + # [[<DateTime today>, 3], [<DateTime yesterday>, 2], etc.] | |
| class CumulatedReport < Report | |
| # Runs the report (see Simplabs::ReportsAsSparkline::Report#run) | |
| diff --git a/lib/simplabs/reports_as_sparkline/grouping.rb b/lib/simplabs/repor… | |
| @@ -2,22 +2,18 @@ module Simplabs #:nodoc: | |
| module ReportsAsSparkline #:nodoc: | |
| - # This is the grouping a report uses to group records in the database | |
| - class Grouping | |
| + class Grouping #:nodoc: | |
| - # ==== Parameters | |
| - # * <tt>identifier</tt> - The identifier of the grouping - one of :hour,… | |
| def initialize(identifier) | |
| raise ArgumentError.new("Invalid grouping #{identifier}") unless [:hou… | |
| @identifier = identifier | |
| end | |
| - # Returns the Grouping's identifier | |
| def identifier | |
| @identifier | |
| end | |
| - def date_parts_from_db_string(db_string) #:nodoc: | |
| + def date_parts_from_db_string(db_string) | |
| return case ActiveRecord::Base.connection.adapter_name | |
| when /mysql/i | |
| from_mysql_db_string(db_string) | |
| diff --git a/lib/simplabs/reports_as_sparkline/report.rb b/lib/simplabs/reports… | |
| @@ -13,14 +13,14 @@ module Simplabs #:nodoc: | |
| # | |
| # ==== Options | |
| # | |
| - # * <tt>:date_column</tt> - The name of the date column on that the reco… | |
| - # * <tt>:value_column</tt> - The name of the column that holds the value… | |
| - # * <tt>:aggregation</tt> - The aggregation to use (one of :count, :sum,… | |
| - # * <tt>:grouping</tt> - The period records are grouped on (:hour, :day,… | |
| - # * <tt>:limit</tt> - The number of periods to get (see :grouping) | |
| - # * <tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; o… | |
| - # * <tt>:live_data</tt> - Specified whether data for the current reporti… | |
| - # * <tt>:end_date</tt> - When specified, the report will only include da… | |
| + # * <tt>:date_column</tt> - The name of the date column over that the re… | |
| + # * <tt>:value_column</tt> - The name of the column that holds the value… | |
| + # * <tt>:aggregation</tt> - The aggregation to use (one of <tt>:count</t… | |
| + # * <tt>:grouping</tt> - The period records are grouped on (<tt>:hour</t… | |
| + # * <tt>:limit</tt> - The number of reporting periods to get (see <tt>:g… | |
| + # * <tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#fin… | |
| + # * <tt>:live_data</tt> - Specifies whether data for the current reporti… | |
| + # * <tt>:end_date</tt> - When specified, the report will only include da… | |
| def initialize(klass, name, options = {}) | |
| ensure_valid_options(options) | |
| @klass = klass | |
| @@ -42,11 +42,11 @@ module Simplabs #:nodoc: | |
| # Runs the report and returns an array of array of DateTimes and Floats | |
| # | |
| # ==== Options | |
| - # * <tt>:limit</tt> - The number of periods to get | |
| - # * <tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; o… | |
| - # * <tt>:grouping</tt> - The period records are grouped on (:hour, :day,… | |
| - # * <tt>:live_data</tt> - Specified whether data for the current reporti… | |
| - # * <tt>:end_date</tt> - When specified, the report will only include da… | |
| + # * <tt>:grouping</tt> - The period records are grouped on (<tt>:hour</t… | |
| + # * <tt>:limit</tt> - The number of reporting periods to get (see <tt>:g… | |
| + # * <tt>:conditions</tt> - Conditions like in <tt>ActiveRecord::Base#fin… | |
| + # * <tt>:live_data</tt> - Specifies whether data for the current reporti… | |
| + # * <tt>:end_date</tt> - When specified, the report will only include da… | |
| def run(options = {}) | |
| custom_conditions = options.key?(:conditions) | |
| options = options_for_run(options) | |
| diff --git a/lib/simplabs/reports_as_sparkline/report_cache.rb b/lib/simplabs/r… | |
| @@ -2,11 +2,13 @@ module Simplabs #:nodoc: | |
| module ReportsAsSparkline #:nodoc: | |
| - class ReportCache < ActiveRecord::Base #:nodoc: | |
| + # The ReportCache class is a regular +ActiveRecord+ model and represents c… | |
| + # ReportCache instances are identified by the combination of +model_name+,… | |
| + class ReportCache < ActiveRecord::Base | |
| set_table_name :reports_as_sparkline_cache | |
| - def self.process(report, options, cache = true, &block) | |
| + def self.process(report, options, cache = true, &block) #:nodoc: | |
| raise ArgumentError.new('A block must be given') unless block_given? | |
| self.transaction do | |
| cached_data = [] | |
| diff --git a/lib/simplabs/reports_as_sparkline/reporting_period.rb b/lib/simpla… | |
| @@ -2,29 +2,20 @@ module Simplabs #:nodoc: | |
| module ReportsAsSparkline #:nodoc: | |
| - # A ReportingPeriod is - depending on the Grouping - either a specific ho… | |
| - class ReportingPeriod | |
| + class ReportingPeriod #:nodoc: | |
| attr_reader :date_time, :grouping | |
| - # ==== Parameters | |
| - # * <tt>grouping</tt> - The Simplabs::ReportsAsSparkline::Grouping of th… | |
| - # * <tt>date_time</tt> - The DateTime that reporting period is created f… | |
| def initialize(grouping, date_time = nil) | |
| @grouping = grouping | |
| @date_time = parse_date_time(date_time || DateTime.now) | |
| end | |
| - # Returns the first reporting period for a grouping and a limit; e.g. th… | |
| - # | |
| - # ==== Parameters | |
| - # * <tt>grouping</tt> - The Simplabs::ReportsAsSparkline::Grouping of th… | |
| - # * <tt>limit</tt> - The number of reporting periods until the first one | |
| def self.first(grouping, limit, end_date = nil) | |
| self.new(grouping, end_date).offset(-limit) | |
| end | |
| - def self.from_db_string(grouping, db_string) #:nodoc: | |
| + def self.from_db_string(grouping, db_string) | |
| parts = grouping.date_parts_from_db_string(db_string) | |
| result = case grouping.identifier | |
| when :hour | |
| @@ -39,39 +30,33 @@ module Simplabs #:nodoc: | |
| result | |
| end | |
| - # Returns the next reporting period (that is next hour/day/month/year) | |
| def next | |
| self.offset(1) | |
| end | |
| - # Returns the previous reporting period (that is next hour/day/month/yea… | |
| def previous | |
| self.offset(-1) | |
| end | |
| - # Returns the reporting period with the specified offset from the current | |
| - # | |
| - # ==== Parameters | |
| - # * <tt>offset</tt> - The offset to return the reporting period for (spe… | |
| def offset(offset) | |
| self.class.new(@grouping, @date_time + offset.send(@grouping.identifie… | |
| end | |
| - def ==(other) #:nodoc: | |
| + def ==(other) | |
| if other.class == Simplabs::ReportsAsSparkline::ReportingPeriod | |
| return @date_time.to_s == other.date_time.to_s && @grouping.identifi… | |
| end | |
| false | |
| end | |
| - def <(other) #:nodoc: | |
| + def <(other) | |
| if other.class == Simplabs::ReportsAsSparkline::ReportingPeriod | |
| return @date_time < other.date_time | |
| end | |
| raise ArgumentError.new("Can only compare instances of #{Simplabs::Rep… | |
| end | |
| - def last_date_time #:nodoc: | |
| + def last_date_time | |
| case @grouping.identifier | |
| when :hour | |
| DateTime.new(@date_time.year, @date_time.month, @date_time.day, @d… | |
| diff --git a/lib/simplabs/reports_as_sparkline/sparkline_tag_helper.rb b/lib/si… | |
| @@ -8,7 +8,7 @@ module Simplabs #:nodoc: | |
| # | |
| # ==== Parameters | |
| # | |
| - # * <tt>data</tt> - The data to render the sparkline for | |
| + # * <tt>data</tt> - The data to render the sparkline for, is retrieved f… | |
| # | |
| # ==== Options | |
| # | |
| @@ -16,10 +16,10 @@ module Simplabs #:nodoc: | |
| # * <tt>height</tt> - The height of the generated image | |
| # * <tt>line_color</tt> - The line color of the sparkline (hex code) | |
| # * <tt>fill_color</tt> - The color to fill the area below the sparkline… | |
| - # * <tt>labels</tt> - The axes to render lables for (Array of :x, :y, :r… | |
| + # * <tt>labels</tt> - The axes to render lables for (Array of <tt>:x</tt… | |
| # | |
| # ==== Example | |
| - # <%= sparkline_tag(User.registrations_report, :width => 200, :height =>… | |
| + # <tt><%= sparkline_tag(User.registrations_report, :width => 200, :heigh… | |
| def sparkline_tag(data, options = {}) | |
| options.reverse_merge!({ :width => 300, :height => 34, :line_color => … | |
| data = data.collect { |d| d[1] } |