Introduction
Introduction Statistics Contact Development Disclaimer Help
added :live_data option (doesn't do anything yet) - reportable - Fork of report…
Log
Files
Refs
README
---
commit a9b9ce2570cd9c6a5a64b562efebcf5d7b549a27
parent 7b83c887f0424f108d70ecb2a6f74e520821bd61
Author: Marco Otte-Witte <[email protected]>
Date: Mon, 19 Jan 2009 13:15:05 +0100
added :live_data option (doesn't do anything yet)
Diffstat:
M lib/kvlr/reports_as_sparkline.rb | 1 +
M lib/kvlr/reports_as_sparkline/repo… | 7 +++++--
M rdoc/classes/Kvlr/ReportsAsSparkli… | 34 ++++++++++++++++++---------…
M rdoc/classes/Kvlr/ReportsAsSparkli… | 65 +++++++++++++++++++--------…
M rdoc/created.rid | 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 spec/classes/report_spec.rb | 8 ++++----
9 files changed, 73 insertions(+), 50 deletions(-)
---
diff --git a/lib/kvlr/reports_as_sparkline.rb b/lib/kvlr/reports_as_sparkline.rb
@@ -22,6 +22,7 @@ module Kvlr #:nodoc:
# * <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…
#
# ==== Examples
#
diff --git a/lib/kvlr/reports_as_sparkline/report.rb b/lib/kvlr/reports_as_spar…
@@ -19,6 +19,7 @@ module Kvlr #:nodoc:
# * <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…
def initialize(klass, name, options = {})
ensure_valid_options(options)
@klass = klass
@@ -29,7 +30,8 @@ module Kvlr #:nodoc:
@options = {
:limit => options[:limit] || 100,
:conditions => options[:conditions] || [],
- :grouping => Grouping.new(options[:grouping] || :day)
+ :grouping => Grouping.new(options[:grouping] || :day),
+ :live_data => options[:live_data] || false
}
@options.merge!(options)
@options.freeze
@@ -41,6 +43,7 @@ module Kvlr #:nodoc:
# * <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…
def run(options = {})
ensure_valid_options(options, :run)
custom_conditions = options.key?(:conditions)
@@ -84,7 +87,7 @@ module Kvlr #:nodoc:
raise ArgumentError.new('The name of the column holding the valu…
when :run
options.each_key do |k|
- raise ArgumentError.new("Invalid option #{k}") unless [:limit,…
+ raise ArgumentError.new("Invalid option #{k}") unless [:limit,…
end
end
raise ArgumentError.new("Invalid grouping #{options[:grouping]}") if…
diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/ClassMethods.html b/rdoc/clas…
@@ -149,6 +149,12 @@ when using :sum, :value_column must also be specified
records that match there conditions are reported on
</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>
</ul>
<h4>Examples</h4>
<pre>
@@ -167,20 +173,20 @@ records that match there conditions are reported on
onclick="toggleCode('M000002-source');return false;">[Source]</a><…
<div class="method-source-code" id="M000002-source">
<pre>
- <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline.rb, li…
-38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie…
-39: (<span class="ruby-keyword kw">class</span> <span class="ruby-oper…
-40: <span class="ruby-identifier">define_method</span> <span class="…
-41: <span class="ruby-keyword kw">if</span> <span class="ruby-iden…
-42: <span class="ruby-identifier">report</span> = <span class="r…
-43: <span class="ruby-keyword kw">else</span>
-44: <span class="ruby-identifier">report</span> = <span class="r…
-45: <span class="ruby-keyword kw">end</span>
-46: <span class="ruby-identifier">raise</span> <span class="ruby-c…
-47: <span class="ruby-identifier">report</span>.<span class="ruby-…
-48: <span class="ruby-keyword kw">end</span>
-49: <span class="ruby-keyword kw">end</span>
-50: <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline.rb, li…
+39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie…
+40: (<span class="ruby-keyword kw">class</span> <span class="ruby-oper…
+41: <span class="ruby-identifier">define_method</span> <span class="…
+42: <span class="ruby-keyword kw">if</span> <span class="ruby-iden…
+43: <span class="ruby-identifier">report</span> = <span class="r…
+44: <span class="ruby-keyword kw">else</span>
+45: <span class="ruby-identifier">report</span> = <span class="r…
+46: <span class="ruby-keyword kw">end</span>
+47: <span class="ruby-identifier">raise</span> <span class="ruby-c…
+48: <span class="ruby-identifier">report</span>.<span class="ruby-…
+49: <span class="ruby-keyword kw">end</span>
+50: <span class="ruby-keyword kw">end</span>
+51: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/Report.html b/rdoc/classes/Kv…
@@ -202,27 +202,34 @@ when using :sum, :value_column must also be specified
records that match there conditions are reported on
</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>
</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/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="ruby-i…
-25: <span class="ruby-ivar">@name</span> = <span class="ruby-i…
-26: <span class="ruby-ivar">@date_column</span> = (<span class="ruby-…
-27: <span class="ruby-ivar">@value_column</span> = (<span class="ruby-…
-28: <span class="ruby-ivar">@aggregation</span> = <span class="ruby-i…
-29: <span class="ruby-ivar">@options</span> = {
-30: <span class="ruby-identifier">:limit</span> =<span class="r…
-31: <span class="ruby-identifier">:conditions</span> =<span class="r…
-32: <span class="ruby-identifier">:grouping</span> =<span class="r…
-33: }
-34: <span class="ruby-ivar">@options</span>.<span class="ruby-identifi…
-35: <span class="ruby-ivar">@options</span>.<span class="ruby-identifi…
-36: <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-identifie…
+24: <span class="ruby-identifier">ensure_valid_options</span>(<span cl…
+25: <span class="ruby-ivar">@klass</span> = <span class="ruby-i…
+26: <span class="ruby-ivar">@name</span> = <span class="ruby-i…
+27: <span class="ruby-ivar">@date_column</span> = (<span class="ruby-…
+28: <span class="ruby-ivar">@value_column</span> = (<span class="ruby-…
+29: <span class="ruby-ivar">@aggregation</span> = <span class="ruby-i…
+30: <span class="ruby-ivar">@options</span> = {
+31: <span class="ruby-identifier">:limit</span> =<span class="r…
+32: <span class="ruby-identifier">:conditions</span> =<span class="r…
+33: <span class="ruby-identifier">:grouping</span> =<span class="r…
+34: <span class="ruby-identifier">:live_data</span> =<span class="r…
+35: }
+36: <span class="ruby-ivar">@options</span>.<span class="ruby-identifi…
+37: <span class="ruby-ivar">@options</span>.<span class="ruby-identifi…
+38: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
@@ -257,21 +264,27 @@ you specify conditions here, caching will be disabled</b>)
:month)
</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>
</ul>
<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/kvlr/reports_as_sparkline/report…
-44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie…
-45: <span class="ruby-identifier">ensure_valid_options</span>(<span cl…
-46: <span class="ruby-identifier">custom_conditions</span> = <span cla…
-47: <span class="ruby-identifier">options</span>.<span class="ruby-ide…
-48: <span class="ruby-identifier">options</span>[<span class="ruby-ide…
-49: <span class="ruby-constant">ReportCache</span>.<span class="ruby-i…
-50: <span class="ruby-identifier">read_data</span>(<span class="ruby…
-51: <span class="ruby-keyword kw">end</span>
-52: <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report…
+47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifie…
+48: <span class="ruby-identifier">ensure_valid_options</span>(<span cl…
+49: <span class="ruby-identifier">custom_conditions</span> = <span cla…
+50: <span class="ruby-identifier">options</span>.<span class="ruby-ide…
+51: <span class="ruby-identifier">options</span>[<span class="ruby-ide…
+52: <span class="ruby-constant">ReportCache</span>.<span class="ruby-i…
+53: <span class="ruby-identifier">read_data</span>(<span class="ruby…
+54: <span class="ruby-keyword kw">end</span>
+55: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
diff --git a/rdoc/created.rid b/rdoc/created.rid
@@ -1 +1 @@
-Thu, 15 Jan 2009 17:07:33 +0100
+Mon, 19 Jan 2009 13:09:50 +0100
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 Jan 15 12:20:10 +0100 2009</td>
+ <td>Thu Jan 15 18:29:30 +0100 2009</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 Jan 15 15:32:37 +0100 2009</td>
+ <td>Mon Jan 19 13:09:10 +0100 2009</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 Jan 15 15:31:55 +0100 2009</td>
+ <td>Mon Jan 19 13:09:03 +0100 2009</td>
</tr>
</table>
</div>
diff --git a/spec/classes/report_spec.rb b/spec/classes/report_spec.rb
@@ -11,7 +11,7 @@ describe Kvlr::ReportsAsSparkline::Report do
it 'should process the data with the report cache' do
Kvlr::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
@report,
- { :limit => 100, :grouping => @report.options[:grouping], :conditions …
+ { :limit => 100, :grouping => @report.options[:grouping], :conditions …
true
)
@@ -21,7 +21,7 @@ describe Kvlr::ReportsAsSparkline::Report do
it 'should process the data with the report cache and specify cache = fals…
Kvlr::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
@report,
- { :limit => 100, :grouping => @report.options[:grouping], :conditions …
+ { :limit => 100, :grouping => @report.options[:grouping], :conditions …
false
)
@@ -39,7 +39,7 @@ describe Kvlr::ReportsAsSparkline::Report do
Kvlr::ReportsAsSparkline::Grouping.should_receive(:new).once.with(:month…
Kvlr::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
@report,
- { :limit => 100, :grouping => grouping, :conditions => [] },
+ { :limit => 100, :grouping => grouping, :conditions => [], :live_data …
true
)
@@ -242,7 +242,7 @@ describe Kvlr::ReportsAsSparkline::Report do
describe 'for context :run' do
it 'should not raise an error if valid options are specified' do
- lambda { @report.send(:ensure_valid_options, { :limit => 100, :conditi…
+ lambda { @report.send(:ensure_valid_options, { :limit => 100, :conditi…
}.should_not raise_error(ArgumentError)
end
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.