| removed core extensions - reportable - Fork of reportable required by WarVox, f… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 47462cefd9e5936c8ca94bfbe1530aa794f4860e | |
| parent b15fdc0f574ec4fb68328b05d0176c890d21deda | |
| Author: Marco Otte-Witte <[email protected]> | |
| Date: Wed, 14 Jan 2009 18:15:56 +0800 | |
| removed core extensions | |
| Signed-off-by: Marco Otte-Witte <[email protected]> | |
| Diffstat: | |
| M init.rb | 1 - | |
| D lib/kvlr/core_extensions/date.rb | 25 ------------------------- | |
| M lib/kvlr/reports_as_sparkline/repo… | 2 +- | |
| D spec/other/date_spec.rb | 27 --------------------------- | |
| 4 files changed, 1 insertion(+), 54 deletions(-) | |
| --- | |
| diff --git a/init.rb b/init.rb | |
| @@ -1,5 +1,4 @@ | |
| require 'kvlr/reports_as_sparkline' | |
| -require 'kvlr/core_extensions/date' | |
| ActiveRecord::Base.class_eval do | |
| include Kvlr::ReportsAsSparkline | |
| diff --git a/lib/kvlr/core_extensions/date.rb b/lib/kvlr/core_extensions/date.rb | |
| @@ -1,25 +0,0 @@ | |
| -module Kvlr #:nodoc: | |
| - | |
| - module CoreExtensions #:nodoc: | |
| - | |
| - module Date | |
| - | |
| - ::Date.class_eval do | |
| - | |
| - # Converts the DateTime into a Kvlr::ReportsAsSparkline::ReportingPeri… | |
| - def to_reporting_period(grouping) | |
| - if grouping.is_a?(Symbol) | |
| - grouping = Kvlr::ReportsAsSparkline::Grouping.new(grouping) | |
| - elsif !grouping.is_a?(Kvlr::ReportsAsSparkline::Grouping) | |
| - raise ArgumentError.new('grouping must be either an instance of Kv… | |
| - end | |
| - Kvlr::ReportsAsSparkline::ReportingPeriod.new(grouping, self) | |
| - end | |
| - | |
| - end | |
| - | |
| - end | |
| - | |
| - end | |
| - | |
| -end | |
| diff --git a/lib/kvlr/reports_as_sparkline/report_cache.rb b/lib/kvlr/reports_a… | |
| @@ -23,7 +23,7 @@ module Kvlr #:nodoc: | |
| :limit => limit, | |
| :order => 'reporting_period ASC' | |
| ) | |
| - last_reporting_period_to_read = cached_data.last.reporting_period.… | |
| + last_reporting_period_to_read = ReportingPeriod.new(grouping, cach… | |
| end | |
| new_data = yield(last_reporting_period_to_read.date_time) | |
| prepare_result(new_data, cached_data, last_reporting_period_to_read,… | |
| diff --git a/spec/other/date_spec.rb b/spec/other/date_spec.rb | |
| @@ -1,27 +0,0 @@ | |
| -require File.join(File.dirname(__FILE__), '..', 'spec_helper') | |
| - | |
| -describe Date do | |
| - | |
| - describe '#to_reporting_period' do | |
| - | |
| - it 'should return a reporting period for the specified grouping and instan… | |
| - date_time = DateTime.now | |
| - grouping = Kvlr::ReportsAsSparkline::Grouping.new(:hour) | |
| - | |
| - date_time.to_reporting_period(grouping).should == Kvlr::ReportsAsSparkli… | |
| - end | |
| - | |
| - it 'should return a reporting period for the specified grouping and instan… | |
| - date_time = DateTime.now | |
| - grouping = Kvlr::ReportsAsSparkline::Grouping.new(:hour) | |
| - | |
| - date_time.to_reporting_period(:hour).should == Kvlr::ReportsAsSparkline:… | |
| - end | |
| - | |
| - it 'should raise an ArgumentError if the grouping is not specified as a sy… | |
| - lambda { DateTime.now.to_reporting_period(1) }.should raise_error(Argume… | |
| - end | |
| - | |
| - end | |
| - | |
| -end |