documentation done; THIS FINALLY IS V0.1 - reportable - Unnamed repository; edi… | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit a90c63b9ab845475800848a611f27a91b564bfa8 | |
parent 793ccc345c8f37fa8cbfc3eb8579779d1c248ffa | |
Author: marcoow <[email protected]> | |
Date: Fri, 12 Dec 2008 03:19:05 +0800 | |
documentation done; THIS FINALLY IS V0.1 | |
Signed-off-by: Marco Otte-Witte <[email protected]> | |
Diffstat: | |
M README.rdoc | 36 +++++++++++++++--------------… | |
M lib/kvlr/reports_as_sparkline.rb | 2 +- | |
M lib/kvlr/reports_as_sparkline/asse… | 8 ++++---- | |
M lib/kvlr/reports_as_sparkline/grou… | 5 ++--- | |
M lib/kvlr/reports_as_sparkline/repo… | 18 ++++++++++++++++++ | |
M lib/kvlr/reports_as_sparkline/repo… | 10 ++++++++++ | |
M rdoc/classes/Kvlr/CoreExtensions/D… | 12 ++++++------ | |
M rdoc/classes/Kvlr/ReportsAsSparkli… | 24 ++++++++++++++++-------- | |
M rdoc/classes/Kvlr/ReportsAsSparkli… | 5 +++-- | |
M rdoc/classes/Kvlr/ReportsAsSparkli… | 17 ++++++++++------- | |
M rdoc/classes/Kvlr/ReportsAsSparkli… | 135 +++++++++------------------… | |
M rdoc/classes/Kvlr/ReportsAsSparkli… | 132 ++++++++++++++++++++++-----… | |
D rdoc/classes/Kvlr/ReportsAsSparkli… | 167 ---------------------------… | |
M rdoc/classes/Kvlr/ReportsAsSparkli… | 202 ++++++++++++++-------------… | |
M rdoc/created.rid | 2 +- | |
M rdoc/files/README_rdoc.html | 42 +++++++++++++----------------… | |
M rdoc/files/lib/kvlr/reports_as_spa… | 2 +- | |
M rdoc/files/lib/kvlr/reports_as_spa… | 2 +- | |
M rdoc/files/lib/kvlr/reports_as_spa… | 2 +- | |
M rdoc/files/lib/kvlr/reports_as_spa… | 2 +- | |
M rdoc/files/lib/kvlr/reports_as_spa… | 2 +- | |
M rdoc/files/lib/kvlr/reports_as_spa… | 2 +- | |
M rdoc/files/lib/kvlr/reports_as_spa… | 2 +- | |
M rdoc/fr_class_index.html | 1 - | |
M rdoc/fr_method_index.html | 21 ++++++++------------- | |
25 files changed, 348 insertions(+), 505 deletions(-) | |
--- | |
diff --git a/README.rdoc b/README.rdoc | |
@@ -1,29 +1,27 @@ | |
= ReportsAsSparkline | |
-ReportsAsSparkline enables you to generate reports and sparklines from your da… | |
+ReportsAsSparkline enables you to generate reports and sparklines from your mo… | |
-### Example | |
+== Example | |
-This shows the first basic usage. Consider the following user model, including… | |
+This shows the basic usage. Consider the following user model, including +crea… | |
- class User < ActiveRecord::Base | |
- report_as_sparkline :registrations | |
- report_as_sparkline :activations, :date_column => :activated_at | |
- report_as_sparkline :total_users, :cumulate => :registrations | |
+ class User < ActiveRecord::Base | |
+ report_as_sparkline :registrations | |
+ report_as_sparkline :activations, :date_column_name => :activated_at | |
+ report_as_sparkline :total_users, :cumulate => true | |
end | |
-Using *report_as_sparkline* like this will add the following class methods to … | |
- | |
- # Generates a sparkline from the google chart api | |
- # so you see the registrations per day | |
- User.registrations_graph | |
- | |
- # Gets an array of the data to use in numerical display | |
- User.registrations_report | |
- | |
-### Implemented features | |
-* cumulate option that depends on other report | |
- | |
+Using +report_as_sparkline+ like this will add the following class methods to … | |
+ | |
+ User.registrations_report | |
+ User.activations_report | |
+ User.total_users_report | |
+ | |
+You can than render sparklines for these reports with sparkline_tag in your vi… | |
+ | |
+ <%= sparkline_tag(User.registrations_report) %> | |
+ | |
== TODOs/ future plans | |
* support for Oracle and DB2 (and others?) missing | |
diff --git a/lib/kvlr/reports_as_sparkline.rb b/lib/kvlr/reports_as_sparkline.rb | |
@@ -8,7 +8,7 @@ module Kvlr #:nodoc: | |
module ClassMethods | |
- # Generates a report on a model. The report can then be executed via <na… | |
+ # Generates a report on a model. That report can then be executed via th… | |
# | |
# ==== Parameters | |
# | |
diff --git a/lib/kvlr/reports_as_sparkline/asset_tag_helper.rb b/lib/kvlr/repor… | |
@@ -8,13 +8,13 @@ module Kvlr #:nodoc: | |
# | |
# ==== Parameters | |
# | |
- # *<tt>data</tt> - The data to render the sparkline for | |
+ # * <tt>data</tt> - The data to render the sparkline for | |
# | |
# ==== Options | |
# | |
- # *<tt>width</tt> - The width of the generated image | |
- # *<tt>height</tt> - The height of the generated image | |
- # *<tt>color</tt> - The base color of the generated image (hex code) | |
+ # * <tt>width</tt> - The width of the generated image | |
+ # * <tt>height</tt> - The height of the generated image | |
+ # * <tt>color</tt> - The base color of the generated image (hex code) | |
# | |
# ==== Example | |
# <%= sparkline_tag(User.registrations_report, :width => 200, :height =>… | |
diff --git a/lib/kvlr/reports_as_sparkline/grouping.rb b/lib/kvlr/reports_as_sp… | |
@@ -3,11 +3,10 @@ module Kvlr #:nodoc: | |
module ReportsAsSparkline #:nodoc: | |
# This is the grouping a report uses to group records in the database | |
- # | |
- # ==== Parameters | |
- # * <tt>identifier</tt> - The identifier of the grouping - one of :hour, … | |
class Grouping | |
+ # ==== Parameters | |
+ # * <tt>identifier</tt> - The identifier of the grouping - one of :hour,… | |
def initialize(identifier) | |
raise ArgumentError.new("Invalid grouping #{grouping}") unless [:hour,… | |
@identifier = identifier | |
diff --git a/lib/kvlr/reports_as_sparkline/report.rb b/lib/kvlr/reports_as_spar… | |
@@ -2,10 +2,23 @@ module Kvlr #:nodoc: | |
module ReportsAsSparkline #:nodoc: | |
+ # The Report class that does all the data retrieval and calculations | |
class Report | |
attr_reader :klass, :name, :date_column_name, :value_column_name, :group… | |
+ # ==== Parameters | |
+ # * <tt>klass</tt> - The model the report works on (This is the class yo… | |
+ # * <tt>name</tt> - The name of the report (as in Kvlr::ReportsAsSparkli… | |
+ # | |
+ # ==== Options | |
+ # | |
+ # * <tt>:date_column_name</tt> - The name of the date column on that the… | |
+ # * <tt>:value_column_name</tt> - The name of the column that holds the … | |
+ # * <tt>:aggregation</tt> - The aggregation to use (either :count or :su… | |
+ # * <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… | |
def initialize(klass, name, options = {}) | |
ensure_valid_options(options) | |
@klass = klass | |
@@ -21,6 +34,11 @@ module Kvlr #:nodoc: | |
@options.merge!(options) | |
end | |
+ # 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… | |
def run(options = {}) | |
ensure_valid_options(options, :run) | |
custom_conditions = options.key?(:conditions) | |
diff --git a/lib/kvlr/reports_as_sparkline/reporting_period.rb b/lib/kvlr/repor… | |
@@ -2,15 +2,24 @@ module Kvlr #:nodoc: | |
module ReportsAsSparkline #:nodoc: | |
+ # A ReportingPeriod is - depending on the Grouping - either a specific ho… | |
class ReportingPeriod | |
attr_reader :date_time, :grouping | |
+ # ==== Parameters | |
+ # * <tt>grouping</tt> - The Kvlr::ReportsAsSparkline::Grouping of the re… | |
+ # * <tt>date_time</tt> - The DateTime that reporting period is created f… | |
def initialize(grouping, date_time = DateTime.now) | |
@grouping = grouping | |
@date_time = parse_date_time(date_time) | |
end | |
+ # Returns the first reporting period for a grouping and a limit; e.g. th… | |
+ # | |
+ # ==== Parameters | |
+ # * <tt>grouping</tt> - The Kvlr::ReportsAsSparkline::Grouping of the re… | |
+ # * <tt>limit</tt> - The number of reporting periods until the first one | |
def self.first(grouping, limit) | |
return case grouping.identifier | |
when :hour | |
@@ -40,6 +49,7 @@ module Kvlr #:nodoc: | |
result | |
end | |
+ # Returns the previous reporting period | |
def previous | |
return case @grouping.identifier | |
when :hour | |
diff --git a/rdoc/classes/Kvlr/CoreExtensions/DateTime.html b/rdoc/classes/Kvlr… | |
@@ -80,7 +80,7 @@ | |
<h3 class="section-bar">Methods</h3> | |
<div class="name-list"> | |
- <a href="#M000016">to_reporting_period</a> | |
+ <a href="#M000011">to_reporting_period</a> | |
</div> | |
</div> | |
@@ -102,11 +102,11 @@ | |
<div id="methods"> | |
<h3 class="section-bar">Public Instance methods</h3> | |
- <div id="method-M000016" class="method-detail"> | |
- <a name="M000016"></a> | |
+ <div id="method-M000011" class="method-detail"> | |
+ <a name="M000011"></a> | |
<div class="method-heading"> | |
- <a href="#M000016" class="method-signature"> | |
+ <a href="#M000011" class="method-signature"> | |
<span class="method-name">to_reporting_period</span><span class="met… | |
</a> | |
</div> | |
@@ -117,8 +117,8 @@ Converts the <a href="DateTime.html">DateTime</a> into a <a | |
href="../ReportsAsSparkline/ReportingPeriod.html">Kvlr::ReportsAsSparkline::Re… | |
</p> | |
<p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000016-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000016-source"> | |
+ onclick="toggleCode('M000011-source');return false;">[Source]</a><… | |
+ <div class="method-source-code" id="M000011-source"> | |
<pre> | |
<span class="ruby-comment cmt"># File lib/kvlr/core_extensions/date_time.r… | |
10: <span class="ruby-keyword kw">def</span> <span class="ruby-identif… | |
diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/AssetTagHelper.html b/rdoc/cl… | |
@@ -116,15 +116,23 @@ | |
Renders a sparkline with the given data. | |
</p> | |
<h4>Parameters</h4> | |
-<p> | |
-*<tt>data</tt> - The data to render the sparkline for | |
-</p> | |
+<ul> | |
+<li><tt>data</tt> - The data to render the sparkline for | |
+ | |
+</li> | |
+</ul> | |
<h4>Options</h4> | |
-<p> | |
-*<tt>width</tt> - The width of the generated image *<tt>height</tt> - The | |
-height of the generated image *<tt>color</tt> - The base color of the | |
-generated image (hex code) | |
-</p> | |
+<ul> | |
+<li><tt>width</tt> - The width of the generated image | |
+ | |
+</li> | |
+<li><tt>height</tt> - The height of the generated image | |
+ | |
+</li> | |
+<li><tt>color</tt> - The base color of the generated image (hex code) | |
+ | |
+</li> | |
+</ul> | |
<h4>Example</h4> | |
<p> | |
<%= <a | |
diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/ClassMethods.html b/rdoc/clas… | |
@@ -113,8 +113,9 @@ | |
<div class="method-description"> | |
<p> | |
-Generates a report on a model. The report can then be executed via | |
-<name>_report | |
+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#M000010">Kvlr::ReportsAsSparkline::Report#run</a>). | |
</p> | |
<h4>Parameters</h4> | |
<ul> | |
diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/CumulatedReport.html b/rdoc/c… | |
@@ -88,9 +88,12 @@ href="Report.html">Kvlr::ReportsAsSparkline::Report</a>) | |
<h4>Examples</h4> | |
<pre> | |
When Kvlr::ReportsAsSparkline::Report returns | |
- [[<DateTime today>, 1], [<DateTime yesterday>, 2]] | |
+ | |
+ [[<DateTime today>, 1], [<DateTime yesterday>, 2], etc.] | |
+ | |
Kvlr::ReportsAsSparkline::CumulatedReport returns | |
- [[<DateTime today>, 3], [<DateTime yesterday>, 2]] | |
+ | |
+ [[<DateTime today>, 3], [<DateTime yesterday>, 2], etc.] | |
</pre> | |
</div> | |
@@ -136,16 +139,16 @@ href="Report.html">Kvlr::ReportsAsSparkline::Report</a>) | |
<div class="method-description"> | |
<p> | |
Runs the report (see <a | |
-href="Report.html#M000015">Kvlr::ReportsAsSparkline::Report#run</a>) | |
+href="Report.html#M000010">Kvlr::ReportsAsSparkline::Report#run</a>) | |
</p> | |
<p><a class="source-toggle" href="#" | |
onclick="toggleCode('M000003-source');return false;">[Source]</a><… | |
<div class="method-source-code" id="M000003-source"> | |
<pre> | |
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/cumula… | |
-16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
-17: <span class="ruby-identifier">cumulate</span>(<span class="ruby-ke… | |
-18: <span class="ruby-keyword kw">end</span> | |
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/cumula… | |
+19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
+20: <span class="ruby-identifier">cumulate</span>(<span class="ruby-ke… | |
+21: <span class="ruby-keyword kw">end</span> | |
</pre> | |
</div> | |
</div> | |
diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/Grouping.html b/rdoc/classes/… | |
@@ -78,6 +78,12 @@ | |
<div id="contextContent"> | |
+ <div id="description"> | |
+ <p> | |
+This is the grouping a report uses to group records in the database | |
+</p> | |
+ | |
+ </div> | |
</div> | |
@@ -86,10 +92,8 @@ | |
<h3 class="section-bar">Methods</h3> | |
<div class="name-list"> | |
- <a href="#M000007">date_parts_from_db_string</a> | |
- <a href="#M000006">identifier</a> | |
- <a href="#M000005">new</a> | |
- <a href="#M000008">to_sql</a> | |
+ <a href="#M000005">identifier</a> | |
+ <a href="#M000004">new</a> | |
</div> | |
</div> | |
@@ -111,25 +115,33 @@ | |
<div id="methods"> | |
<h3 class="section-bar">Public Class methods</h3> | |
- <div id="method-M000005" class="method-detail"> | |
- <a name="M000005"></a> | |
+ <div id="method-M000004" class="method-detail"> | |
+ <a name="M000004"></a> | |
<div class="method-heading"> | |
- <a href="#M000005" class="method-signature"> | |
- <span class="method-name">new</span><span class="method-args">(group… | |
+ <a href="#M000004" 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#M000005">identifier</a></tt> - The <a | |
+href="Grouping.html#M000005">identifier</a> of the grouping - one of :hour, | |
+:day, :week or :month | |
+ | |
+</li> | |
+</ul> | |
<p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000005-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000005-source"> | |
+ onclick="toggleCode('M000004-source');return false;">[Source]</a><… | |
+ <div class="method-source-code" id="M000004-source"> | |
<pre> | |
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/groupi… | |
- 7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
- 8: <span class="ruby-identifier">raise</span> <span class="ruby-const… | |
- 9: <span class="ruby-ivar">@identifier</span> = <span class="ruby-ide… | |
-10: <span class="ruby-keyword kw">end</span> | |
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/groupi… | |
+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> | |
@@ -137,95 +149,28 @@ | |
<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">date_parts_from_db_string</span><span clas… | |
- </a> | |
- </div> | |
- | |
- <div class="method-description"> | |
- <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/kvlr/reports_as_sparkline/groupi… | |
-16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
-17: <span class="ruby-keyword kw">if</span> <span class="ruby-constant… | |
-18: <span class="ruby-keyword kw">case</span> <span class="ruby-ivar… | |
-19: <span class="ruby-keyword kw">when</span> <span class="ruby-id… | |
-20: <span class="ruby-keyword kw">return</span> (<span class="ru… | |
-21: <span class="ruby-keyword kw">when</span> <span class="ruby-id… | |
-22: <span class="ruby-keyword kw">return</span> <span class="rub… | |
-23: <span class="ruby-keyword kw">when</span> <span class="ruby-id… | |
-24: <span class="ruby-identifier">parts</span> = <span class="ru… | |
-25: <span class="ruby-identifier">date</span> = <span class="rub… | |
-26: <span class="ruby-keyword kw">return</span> [<span class="ru… | |
-27: <span class="ruby-keyword kw">when</span> <span class="ruby-id… | |
-28: <span class="ruby-keyword kw">return</span> <span class="rub… | |
-29: <span class="ruby-keyword kw">end</span> | |
-30: <span class="ruby-keyword kw">else</span> | |
-31: <span class="ruby-identifier">parts</span> = <span class="ruby-i… | |
-32: <span class="ruby-keyword kw">return</span> <span class="ruby-id… | |
-33: <span class="ruby-identifier">parts</span>[<span class="ruby-val… | |
-34: <span class="ruby-identifier">parts</span> | |
-35: <span class="ruby-keyword kw">end</span> | |
-36: <span class="ruby-keyword kw">end</span> | |
-</pre> | |
- </div> | |
- </div> | |
- </div> | |
- | |
- <div id="method-M000006" class="method-detail"> | |
- <a name="M000006"></a> | |
+ <div id="method-M000005" class="method-detail"> | |
+ <a name="M000005"></a> | |
<div class="method-heading"> | |
- <a href="#M000006" class="method-signature"> | |
+ <a href="#M000005" 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#M000005">identifier</a> | |
+</p> | |
<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/kvlr/reports_as_sparkline/groupi… | |
-12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
-13: <span class="ruby-ivar">@identifier</span> | |
-14: <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">to_sql</span><span class="method-args">(da… | |
- </a> | |
- </div> | |
- | |
- <div class="method-description"> | |
- <p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000008-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000008-source"> | |
+ onclick="toggleCode('M000005-source');return false;">[Source]</a><… | |
+ <div class="method-source-code" id="M000005-source"> | |
<pre> | |
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/groupi… | |
-38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
-39: <span class="ruby-keyword kw">return</span> <span class="ruby-keyw… | |
-40: <span class="ruby-keyword kw">when</span> <span class="ruby-valu… | |
-41: <span class="ruby-identifier">mysql_format</span>(<span class=… | |
-42: <span class="ruby-keyword kw">when</span> <span class="ruby-valu… | |
-43: <span class="ruby-identifier">sqlite_format</span>(<span class… | |
-44: <span class="ruby-keyword kw">when</span> <span class="ruby-valu… | |
-45: <span class="ruby-identifier">postgresql_format</span>(<span c… | |
-46: <span class="ruby-keyword kw">end</span> | |
-47: <span class="ruby-keyword kw">end</span> | |
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/groupi… | |
+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> | |
diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/Report.html b/rdoc/classes/Kv… | |
@@ -78,6 +78,13 @@ | |
<div id="contextContent"> | |
+ <div id="description"> | |
+ <p> | |
+The <a href="Report.html">Report</a> class that does all the data retrieval | |
+and calculations | |
+</p> | |
+ | |
+ </div> | |
</div> | |
@@ -86,8 +93,8 @@ | |
<h3 class="section-bar">Methods</h3> | |
<div class="name-list"> | |
- <a href="#M000014">new</a> | |
- <a href="#M000015">run</a> | |
+ <a href="#M000009">new</a> | |
+ <a href="#M000010">run</a> | |
</div> | |
</div> | |
@@ -147,35 +154,74 @@ | |
<div id="methods"> | |
<h3 class="section-bar">Public Class methods</h3> | |
- <div id="method-M000014" class="method-detail"> | |
- <a name="M000014"></a> | |
+ <div id="method-M000009" class="method-detail"> | |
+ <a name="M000009"></a> | |
<div class="method-heading"> | |
- <a href="#M000014" class="method-signature"> | |
+ <a href="#M000009" class="method-signature"> | |
<span class="method-name">new</span><span class="method-args">(klass… | |
</a> | |
</div> | |
<div class="method-description"> | |
+ <h4>Parameters</h4> | |
+<ul> | |
+<li><tt>klass</tt> - The model the report works on (This is the class you | |
+invoke <a | |
+href="ClassMethods.html#M000001">Kvlr::ReportsAsSparkline::ClassMethods#report… | |
+on) | |
+ | |
+</li> | |
+<li><tt>name</tt> - The name of the report (as in <a | |
+href="ClassMethods.html#M000001">Kvlr::ReportsAsSparkline::ClassMethods#report… | |
+ | |
+</li> | |
+</ul> | |
+<h4>Options</h4> | |
+<ul> | |
+<li><tt>:date_column_name</tt> - The name of the date column on that the | |
+records are aggregated | |
+ | |
+</li> | |
+<li><tt>:value_column_name</tt> - The name of the column that holds the value | |
+to sum for aggregation :sum | |
+ | |
+</li> | |
+<li><tt>:aggregation</tt> - The aggregation to use (either :count or :sum); | |
+when using :sum, :value_column_name must also be specified | |
+ | |
+</li> | |
+<li><tt>:grouping</tt> - The period records are grouped on (:hour, :day, :week, | |
+:month) | |
+ | |
+</li> | |
+<li><tt>:limit</tt> - The number of periods to get (see :grouping) | |
+ | |
+</li> | |
+<li><tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; only | |
+records that match there conditions are reported on | |
+ | |
+</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('M000009-source');return false;">[Source]</a><… | |
+ <div class="method-source-code" id="M000009-source"> | |
<pre> | |
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
- 9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
-10: <span class="ruby-identifier">ensure_valid_options</span>(<span cl… | |
-11: <span class="ruby-ivar">@klass</span> = <span class="r… | |
-12: <span class="ruby-ivar">@name</span> = <span class="r… | |
-13: <span class="ruby-ivar">@date_column_name</span> = (<span class="… | |
-14: <span class="ruby-ivar">@value_column_name</span> = (<span class="… | |
-15: <span class="ruby-ivar">@aggregation</span> = <span class="r… | |
-16: <span class="ruby-ivar">@grouping</span> = <span class="r… | |
-17: <span class="ruby-ivar">@options</span> = { | |
-18: <span class="ruby-identifier">:limit</span> =<span c… | |
-19: <span class="ruby-identifier">:conditions</span> =<span c… | |
-20: } | |
-21: <span class="ruby-ivar">@options</span>.<span class="ruby-identifi… | |
-22: <span class="ruby-keyword kw">end</span> | |
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
+22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
+23: <span class="ruby-identifier">ensure_valid_options</span>(<span cl… | |
+24: <span class="ruby-ivar">@klass</span> = <span class="r… | |
+25: <span class="ruby-ivar">@name</span> = <span class="r… | |
+26: <span class="ruby-ivar">@date_column_name</span> = (<span class="… | |
+27: <span class="ruby-ivar">@value_column_name</span> = (<span class="… | |
+28: <span class="ruby-ivar">@aggregation</span> = <span class="r… | |
+29: <span class="ruby-ivar">@grouping</span> = <span class="r… | |
+30: <span class="ruby-ivar">@options</span> = { | |
+31: <span class="ruby-identifier">:limit</span> =<span c… | |
+32: <span class="ruby-identifier">:conditions</span> =<span c… | |
+33: } | |
+34: <span class="ruby-ivar">@options</span>.<span class="ruby-identifi… | |
+35: <span class="ruby-keyword kw">end</span> | |
</pre> | |
</div> | |
</div> | |
@@ -183,29 +229,43 @@ | |
<h3 class="section-bar">Public Instance methods</h3> | |
- <div id="method-M000015" class="method-detail"> | |
- <a name="M000015"></a> | |
+ <div id="method-M000010" class="method-detail"> | |
+ <a name="M000010"></a> | |
<div class="method-heading"> | |
- <a href="#M000015" class="method-signature"> | |
+ <a href="#M000010" class="method-signature"> | |
<span class="method-name">run</span><span class="method-args">(optio… | |
</a> | |
</div> | |
<div class="method-description"> | |
+ <p> | |
+Runs the report and returns an array of array of DateTimes and Floats | |
+</p> | |
+<h4>Options</h4> | |
+<ul> | |
+<li><tt>:limit</tt> - The number of periods to get | |
+ | |
+</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> | |
+</ul> | |
<p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000015-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000015-source"> | |
+ onclick="toggleCode('M000010-source');return false;">[Source]</a><… | |
+ <div class="method-source-code" id="M000010-source"> | |
<pre> | |
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
-24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
-25: <span class="ruby-identifier">ensure_valid_options</span>(<span cl… | |
-26: <span class="ruby-identifier">custom_conditions</span> = <span cla… | |
-27: <span class="ruby-identifier">options</span>.<span class="ruby-ide… | |
-28: <span class="ruby-constant">ReportCache</span>.<span class="ruby-i… | |
-29: <span class="ruby-identifier">read_data</span>(<span class="ruby… | |
-30: <span class="ruby-keyword kw">end</span> | |
-31: <span class="ruby-keyword kw">end</span> | |
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
+42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
+43: <span class="ruby-identifier">ensure_valid_options</span>(<span cl… | |
+44: <span class="ruby-identifier">custom_conditions</span> = <span cla… | |
+45: <span class="ruby-identifier">options</span>.<span class="ruby-ide… | |
+46: <span class="ruby-constant">ReportCache</span>.<span class="ruby-i… | |
+47: <span class="ruby-identifier">read_data</span>(<span class="ruby… | |
+48: <span class="ruby-keyword kw">end</span> | |
+49: <span class="ruby-keyword kw">end</span> | |
</pre> | |
</div> | |
</div> | |
diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/ReportCache.html b/rdoc/class… | |
@@ -1,166 +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: Kvlr::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">Kvlr::ReportsAsSparkline::ReportCac… | |
- </tr> | |
- <tr class="top-aligned-row"> | |
- <td><strong>In:</strong></td> | |
- <td> | |
- <a href="../../../files/lib/kvlr/reports_as_sparkline/report_c… | |
- lib/kvlr/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> | |
- | |
- <div id="method-list"> | |
- <h3 class="section-bar">Methods</h3> | |
- | |
- <div class="name-list"> | |
- <a href="#M000004">process</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-M000004" class="method-detail"> | |
- <a name="M000004"></a> | |
- | |
- <div class="method-heading"> | |
- <a href="#M000004" class="method-signature"> | |
- <span class="method-name">process</span><span class="method-args">(r… | |
- </a> | |
- </div> | |
- | |
- <div class="method-description"> | |
- <p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000004-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000004-source"> | |
-<pre> | |
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
- 9: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword k… | |
-10: <span class="ruby-identifier">raise</span> <span class="ruby-const… | |
-11: <span class="ruby-keyword kw">self</span>.<span class="ruby-identi… | |
-12: <span class="ruby-identifier">cached_data</span> = [] | |
-13: <span class="ruby-identifier">last_reporting_period_to_read</spa… | |
-14: <span class="ruby-keyword kw">unless</span> <span class="ruby-id… | |
-15: <span class="ruby-identifier">cached_data</span> = <span class… | |
-16: <span class="ruby-identifier">:all</span>, | |
-17: <span class="ruby-identifier">:conditions</span> =<span clas… | |
-18: <span class="ruby-identifier">:model_name</span> =<span c… | |
-19: <span class="ruby-identifier">:report_name</span> =<span c… | |
-20: <span class="ruby-identifier">:grouping</span> =<span c… | |
-21: <span class="ruby-identifier">:aggregation</span> =<span c… | |
-22: }, | |
-23: <span class="ruby-identifier">:limit</span> =<span class="ru… | |
-24: <span class="ruby-identifier">:order</span> =<span class="ru… | |
-25: ) | |
-26: <span class="ruby-identifier">last_reporting_period_to_read</s… | |
-27: <span class="ruby-keyword kw">end</span> | |
-28: <span class="ruby-identifier">new_data</span> = <span class="rub… | |
-29: <span class="ruby-identifier">prepare_result</span>(<span class=… | |
-30: <span class="ruby-keyword kw">end</span> | |
-31: <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/rdoc/classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html b/rdoc/c… | |
@@ -78,6 +78,14 @@ | |
<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. | |
+</p> | |
+ | |
+ </div> | |
</div> | |
@@ -86,11 +94,9 @@ | |
<h3 class="section-bar">Methods</h3> | |
<div class="name-list"> | |
- <a href="#M000013">==</a> | |
- <a href="#M000010">first</a> | |
- <a href="#M000011">from_db_string</a> | |
- <a href="#M000009">new</a> | |
- <a href="#M000012">previous</a> | |
+ <a href="#M000007">first</a> | |
+ <a href="#M000006">new</a> | |
+ <a href="#M000008">previous</a> | |
</div> | |
</div> | |
@@ -130,92 +136,88 @@ | |
<div id="methods"> | |
<h3 class="section-bar">Public Class methods</h3> | |
- <div id="method-M000010" class="method-detail"> | |
- <a name="M000010"></a> | |
+ <div id="method-M000007" class="method-detail"> | |
+ <a name="M000007"></a> | |
<div class="method-heading"> | |
- <a href="#M000010" class="method-signature"> | |
+ <a href="#M000007" 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#M000007">first</a> reporting | |
+period for a grouping and a limit; e.g. the <a | |
+href="ReportingPeriod.html#M000007">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">Kvlr::ReportsAsSparkline::Grouping</a> of the | |
+reporting period | |
+ | |
+</li> | |
+<li><tt>limit</tt> - The number of reporting periods until the <a | |
+href="ReportingPeriod.html#M000007">first</a> one | |
+ | |
+</li> | |
+</ul> | |
<p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000010-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000010-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/kvlr/reports_as_sparkline/report… | |
-14: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword k… | |
-15: <span class="ruby-keyword kw">return</span> <span class="ruby-keyw… | |
-16: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-17: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-18: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-19: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-20: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-21: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-22: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-23: <span class="ruby-identifier">date</span> = <span class="ruby-… | |
-24: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-25: <span class="ruby-keyword kw">end</span> | |
-26: <span class="ruby-keyword kw">end</span> | |
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
+23: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword k… | |
+24: <span class="ruby-keyword kw">return</span> <span class="ruby-keyw… | |
+25: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
+26: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
+27: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
+28: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
+29: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
+30: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
+31: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
+32: <span class="ruby-identifier">date</span> = <span class="ruby-… | |
+33: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
+34: <span class="ruby-keyword kw">end</span> | |
+35: <span class="ruby-keyword kw">end</span> | |
</pre> | |
</div> | |
</div> | |
</div> | |
- <div id="method-M000011" class="method-detail"> | |
- <a name="M000011"></a> | |
+ <div id="method-M000006" class="method-detail"> | |
+ <a name="M000006"></a> | |
<div class="method-heading"> | |
- <a href="#M000011" class="method-signature"> | |
- <span class="method-name">from_db_string</span><span class="method-a… | |
+ <a href="#M000006" class="method-signature"> | |
+ <span class="method-name">new</span><span class="method-args">(group… | |
</a> | |
</div> | |
<div class="method-description"> | |
- <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/kvlr/reports_as_sparkline/report… | |
-28: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword k… | |
-29: <span class="ruby-identifier">parts</span> = <span class="ruby-ide… | |
-30: <span class="ruby-identifier">result</span> = <span class="ruby-ke… | |
-31: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-32: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-33: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-34: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-35: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-36: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-37: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-38: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-39: <span class="ruby-keyword kw">end</span> | |
-40: <span class="ruby-identifier">result</span> | |
-41: <span class="ruby-keyword kw">end</span> | |
-</pre> | |
- </div> | |
- </div> | |
- </div> | |
+ <h4>Parameters</h4> | |
+<ul> | |
+<li><tt>grouping</tt> - The <a | |
+href="Grouping.html">Kvlr::ReportsAsSparkline::Grouping</a> of the | |
+reporting period | |
- <div id="method-M000009" class="method-detail"> | |
- <a name="M000009"></a> | |
+</li> | |
+<li><tt>date_time</tt> - The DateTime that reporting period is created for | |
- <div class="method-heading"> | |
- <a href="#M000009" class="method-signature"> | |
- <span class="method-name">new</span><span class="method-args">(group… | |
- </a> | |
- </div> | |
- | |
- <div class="method-description"> | |
+</li> | |
+</ul> | |
<p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000009-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000009-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/kvlr/reports_as_sparkline/report… | |
- 9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
-10: <span class="ruby-ivar">@grouping</span> = <span class="ruby-iden… | |
-11: <span class="ruby-ivar">@date_time</span> = <span class="ruby-iden… | |
-12: <span class="ruby-keyword kw">end</span> | |
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
+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> | |
@@ -223,59 +225,37 @@ | |
<h3 class="section-bar">Public Instance methods</h3> | |
- <div id="method-M000013" class="method-detail"> | |
- <a name="M000013"></a> | |
- | |
- <div class="method-heading"> | |
- <a href="#M000013" class="method-signature"> | |
- <span class="method-name">==</span><span class="method-args">(other)… | |
- </a> | |
- </div> | |
- | |
- <div class="method-description"> | |
- <p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000013-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000013-source"> | |
-<pre> | |
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
-56: <span class="ruby-keyword kw">def</span> <span class="ruby-operator"… | |
-57: <span class="ruby-keyword kw">if</span> <span class="ruby-identifi… | |
-58: <span class="ruby-keyword kw">return</span> <span class="ruby-iv… | |
-59: <span class="ruby-keyword kw">end</span> | |
-60: <span class="ruby-keyword kw">false</span> | |
-61: <span class="ruby-keyword kw">end</span> | |
-</pre> | |
- </div> | |
- </div> | |
- </div> | |
- | |
- <div id="method-M000012" class="method-detail"> | |
- <a name="M000012"></a> | |
+ <div id="method-M000008" class="method-detail"> | |
+ <a name="M000008"></a> | |
<div class="method-heading"> | |
- <a href="#M000012" class="method-signature"> | |
+ <a href="#M000008" 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#M000008">previous</a> reporting | |
+period | |
+</p> | |
<p><a class="source-toggle" href="#" | |
- onclick="toggleCode('M000012-source');return false;">[Source]</a><… | |
- <div class="method-source-code" id="M000012-source"> | |
+ onclick="toggleCode('M000008-source');return false;">[Source]</a><… | |
+ <div class="method-source-code" id="M000008-source"> | |
<pre> | |
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
-43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
-44: <span class="ruby-keyword kw">return</span> <span class="ruby-keyw… | |
-45: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-46: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-47: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-48: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-49: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-50: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-51: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
-52: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
-53: <span class="ruby-keyword kw">end</span> | |
-54: <span class="ruby-keyword kw">end</span> | |
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report… | |
+53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie… | |
+54: <span class="ruby-keyword kw">return</span> <span class="ruby-keyw… | |
+55: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
+56: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
+57: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
+58: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
+59: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
+60: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
+61: <span class="ruby-keyword kw">when</span> <span class="ruby-iden… | |
+62: <span class="ruby-keyword kw">self</span>.<span class="ruby-id… | |
+63: <span class="ruby-keyword kw">end</span> | |
+64: <span class="ruby-keyword kw">end</span> | |
</pre> | |
</div> | |
</div> | |
diff --git a/rdoc/created.rid b/rdoc/created.rid | |
@@ -1 +1 @@ | |
-Thu, 11 Dec 2008 19:24:20 +0100 | |
+Thu, 11 Dec 2008 20:18:31 +0100 | |
diff --git a/rdoc/files/README_rdoc.html b/rdoc/files/README_rdoc.html | |
@@ -56,7 +56,7 @@ | |
</tr> | |
<tr class="top-aligned-row"> | |
<td><strong>Last Update:</strong></td> | |
- <td>Thu Dec 04 14:58:12 +0100 2008</td> | |
+ <td>Thu Dec 11 20:18:28 +0100 2008</td> | |
</tr> | |
</table> | |
</div> | |
@@ -72,42 +72,36 @@ | |
<h1>ReportsAsSparkline</h1> | |
<p> | |
ReportsAsSparkline enables you to generate reports and sparklines from your | |
-database with very little effort. | |
+model‘s data with very little effort. | |
</p> | |
+<h2>Example</h2> | |
<p> | |
-### Example | |
-</p> | |
-<p> | |
-This shows the first basic usage. Consider the following user model, | |
-including <b>created_at</b> and <b>activated_at</b> timestamp fields. | |
+This shows the basic usage. Consider the following user model, including | |
+<tt>created_at</tt> and <tt>activated_at</tt> timestamp fields. | |
</p> | |
<pre> | |
- class User < ActiveRecord::Base | |
- report_as_sparkline :registrations | |
- report_as_sparkline :activations, :date_column => :activated_at | |
- report_as_sparkline :total_users, :cumulate => :registrations | |
+ class User < ActiveRecord::Base | |
+ report_as_sparkline :registrations | |
+ report_as_sparkline :activations, :date_column_name => :activated_at | |
+ report_as_sparkline :total_users, :cumulate => true | |
end | |
</pre> | |
<p> | |
-Using <b>report_as_sparkline</b> like this will add the following class | |
+Using <tt>report_as_sparkline</tt> like this will add the following class | |
methods to your User model: | |
</p> | |
<pre> | |
- # Generates a sparkline from the google chart api | |
- # so you see the registrations per day | |
- User.registrations_graph | |
- | |
- # Gets an array of the data to use in numerical display | |
- User.registrations_report | |
+ User.registrations_report | |
+ User.activations_report | |
+ User.total_users_report | |
</pre> | |
<p> | |
-### Implemented features | |
+You can than render sparklines for these reports with sparkline_tag in your | |
+view: | |
</p> | |
-<ul> | |
-<li>cumulate option that depends on other report | |
- | |
-</li> | |
-</ul> | |
+<pre> | |
+ <%= sparkline_tag(User.registrations_report) %> | |
+</pre> | |
<h2>TODOs/ future plans</h2> | |
<ul> | |
<li>support for Oracle and DB2 (and others?) missing | |
diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/asset_tag_helper_rb.html … | |
@@ -56,7 +56,7 @@ | |
</tr> | |
<tr class="top-aligned-row"> | |
<td><strong>Last Update:</strong></td> | |
- <td>Thu Dec 11 19:17:16 +0100 2008</td> | |
+ <td>Thu Dec 11 20:11:04 +0100 2008</td> | |
</tr> | |
</table> | |
</div> | |
diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/cumulated_report_rb.html … | |
@@ -56,7 +56,7 @@ | |
</tr> | |
<tr class="top-aligned-row"> | |
<td><strong>Last Update:</strong></td> | |
- <td>Thu Dec 11 19:24:13 +0100 2008</td> | |
+ <td>Thu Dec 11 19:25:14 +0100 2008</td> | |
</tr> | |
</table> | |
</div> | |
diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/grouping_rb.html b/rdoc/f… | |
@@ -56,7 +56,7 @@ | |
</tr> | |
<tr class="top-aligned-row"> | |
<td><strong>Last Update:</strong></td> | |
- <td>Thu Dec 11 18:45:43 +0100 2008</td> | |
+ <td>Thu Dec 11 20:11:56 +0100 2008</td> | |
</tr> | |
</table> | |
</div> | |
diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/report_cache_rb.html b/rd… | |
@@ -56,7 +56,7 @@ | |
</tr> | |
<tr class="top-aligned-row"> | |
<td><strong>Last Update:</strong></td> | |
- <td>Thu Dec 11 17:45:37 +0100 2008</td> | |
+ <td>Thu Dec 11 19:27:42 +0100 2008</td> | |
</tr> | |
</table> | |
</div> | |
diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/report_rb.html b/rdoc/fil… | |
@@ -56,7 +56,7 @@ | |
</tr> | |
<tr class="top-aligned-row"> | |
<td><strong>Last Update:</strong></td> | |
- <td>Thu Dec 11 19:19:10 +0100 2008</td> | |
+ <td>Thu Dec 11 20:14:36 +0100 2008</td> | |
</tr> | |
</table> | |
</div> | |
diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/reporting_period_rb.html … | |
@@ -56,7 +56,7 @@ | |
</tr> | |
<tr class="top-aligned-row"> | |
<td><strong>Last Update:</strong></td> | |
- <td>Wed Dec 10 15:35:51 +0100 2008</td> | |
+ <td>Thu Dec 11 20:12:58 +0100 2008</td> | |
</tr> | |
</table> | |
</div> | |
diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline_rb.html b/rdoc/files/lib/… | |
@@ -56,7 +56,7 @@ | |
</tr> | |
<tr class="top-aligned-row"> | |
<td><strong>Last Update:</strong></td> | |
- <td>Thu Dec 11 19:07:54 +0100 2008</td> | |
+ <td>Thu Dec 11 20:06:27 +0100 2008</td> | |
</tr> | |
</table> | |
</div> | |
diff --git a/rdoc/fr_class_index.html b/rdoc/fr_class_index.html | |
@@ -26,7 +26,6 @@ | |
<a href="classes/Kvlr/ReportsAsSparkline/CumulatedReport.html">Kvlr::Repor… | |
<a href="classes/Kvlr/ReportsAsSparkline/Grouping.html">Kvlr::ReportsAsSpa… | |
<a href="classes/Kvlr/ReportsAsSparkline/Report.html">Kvlr::ReportsAsSpark… | |
- <a href="classes/Kvlr/ReportsAsSparkline/ReportCache.html">Kvlr::ReportsAs… | |
<a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html">Kvlr::Repor… | |
</div> | |
</div> | |
diff --git a/rdoc/fr_method_index.html b/rdoc/fr_method_index.html | |
@@ -20,22 +20,17 @@ | |
<div id="index"> | |
<h1 class="section-bar">Methods</h1> | |
<div id="index-entries"> | |
- <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000013">== … | |
- <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html#M000007">date_parts… | |
- <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000010">fir… | |
- <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000011">fro… | |
- <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html#M000006">identifier… | |
- <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html#M000005">new (Kvlr:… | |
- <a href="classes/Kvlr/ReportsAsSparkline/Report.html#M000014">new (Kvlr::R… | |
- <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000009">new… | |
- <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000012">pre… | |
- <a href="classes/Kvlr/ReportsAsSparkline/ReportCache.html#M000004">process… | |
+ <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000007">fir… | |
+ <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html#M000005">identifier… | |
+ <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html#M000004">new (Kvlr:… | |
+ <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000006">new… | |
+ <a href="classes/Kvlr/ReportsAsSparkline/Report.html#M000009">new (Kvlr::R… | |
+ <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000008">pre… | |
<a href="classes/Kvlr/ReportsAsSparkline/ClassMethods.html#M000001">report… | |
- <a href="classes/Kvlr/ReportsAsSparkline/Report.html#M000015">run (Kvlr::R… | |
<a href="classes/Kvlr/ReportsAsSparkline/CumulatedReport.html#M000003">run… | |
+ <a href="classes/Kvlr/ReportsAsSparkline/Report.html#M000010">run (Kvlr::R… | |
<a href="classes/Kvlr/ReportsAsSparkline/AssetTagHelper.html#M000002">spar… | |
- <a href="classes/Kvlr/CoreExtensions/DateTime.html#M000016">to_reporting_p… | |
- <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html#M000008">to_sql (Kv… | |
+ <a href="classes/Kvlr/CoreExtensions/DateTime.html#M000011">to_reporting_p… | |
</div> | |
</div> | |
</body> |