changed namespacing to better reflect authorship - reportable - Unnamed repository; edit this file 'description' to name the repository.
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit a48dd3186dd2cf21e90f5b2056eca0ab9570991e
 (DIR) parent 9d1f09ef263b73516cb4668d0936eb8fcac694f5
 (HTM) Author: Marco Otte-Witte <marco.otte-witte@simplabs.com>
       Date:   Wed, 15 Apr 2009 17:55:25 +0200
       
       changed namespacing to better reflect authorship
       
       Diffstat:
         M README.rdoc                         |      16 +++++++++++-----
         M init.rb                             |       6 +++---
         D lib/kvlr/reports_as_sparkline.rb    |      57 -------------------------------
         D lib/kvlr/reports_as_sparkline/cumu… |      45 -------------------------------
         D lib/kvlr/reports_as_sparkline/grou… |     119 -------------------------------
         D lib/kvlr/reports_as_sparkline/repo… |     131 -------------------------------
         D lib/kvlr/reports_as_sparkline/repo… |     122 -------------------------------
         D lib/kvlr/reports_as_sparkline/repo… |      90 -------------------------------
         D lib/kvlr/reports_as_sparkline/spar… |      39 -------------------------------
         A lib/simplabs/reports_as_sparkline.… |      58 ++++++++++++++++++++++++++++++
         A lib/simplabs/reports_as_sparkline/… |      45 +++++++++++++++++++++++++++++++
         A lib/simplabs/reports_as_sparkline/… |     119 +++++++++++++++++++++++++++++++
         A lib/simplabs/reports_as_sparkline/… |     129 +++++++++++++++++++++++++++++++
         A lib/simplabs/reports_as_sparkline/… |     116 ++++++++++++++++++++++++++++++
         A lib/simplabs/reports_as_sparkline/… |      94 +++++++++++++++++++++++++++++++
         A lib/simplabs/reports_as_sparkline/… |      39 +++++++++++++++++++++++++++++++
         M rdoc/classes/Kvlr/ReportsAsSparkli… |      16 ++++++++--------
         M rdoc/classes/Kvlr/ReportsAsSparkli… |      18 +++++++++---------
         M rdoc/classes/Kvlr/ReportsAsSparkli… |      12 ++++++------
         M rdoc/classes/Kvlr/ReportsAsSparkli… |      16 ++++++++--------
         M rdoc/classes/Kvlr/ReportsAsSparkli… |      20 ++++++++++----------
         M rdoc/classes/Kvlr/ReportsAsSparkli… |      10 +++++-----
         M rdoc/files/README_rdoc.html         |       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/files/lib/kvlr/reports_as_spa… |       2 +-
         M rdoc/fr_class_index.html            |      12 ++++++------
         M rdoc/fr_file_index.html             |      14 +++++++-------
         M rdoc/fr_method_index.html           |      22 +++++++++++-----------
         M spec/classes/cumulated_report_spec… |      38 ++++++++++++++++----------------
         M spec/classes/grouping_spec.rb       |      38 ++++++++++++++++----------------
         M spec/classes/report_cache_spec.rb   |     128 ++++++++++++++++----------------
         M spec/classes/report_spec.rb         |      66 ++++++++++++++++----------------
         M spec/classes/reporting_period_spec… |      78 ++++++++++++++-----------------
         M spec/other/report_method_spec.rb    |       4 ++--
         M spec/other/sparkline_tag_helper_sp… |       4 ++--
       
       40 files changed, 867 insertions(+), 870 deletions(-)
       ---
 (DIR) diff --git a/README.rdoc b/README.rdoc
       @@ -15,7 +15,7 @@ to it with the following options:
        * :conditions - Conditions like in ActiveRecord::Base#find; only records that match there conditions are reported on
        * :cumulate - Sets whether to cumulate the numbers (instead of [1, 2, 3] returns [1, 3, 6])
        * :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)
       -* :end_date - When specified, the report will be for the periods before this date.
       +* :end_date - When specified, the report will only include data for the periods before this date.
        
        <b>Example:</b>
        
       @@ -66,11 +66,11 @@ Installation requires 3 simple steps:
        
        From your RAILS_ROOT in Rails &gt;= 2.1, do
        
       -  ./script/plugin install git://github.com/myronmarston/reports_as_sparkline.git
       +  ./script/plugin install git://github.com/marcoow/reports_as_sparkline.git
        
        If you are on Rails &lt; 2.1, do this from your RAILS_ROOT
        
       -  git clone git://github.com/myronmarston/reports_as_sparkline.git vendor/plugins/reports_as_sparkline
       +  git clone git://github.com/marcoow/reports_as_sparkline.git vendor/plugins/reports_as_sparkline
        
        <b>generate migration</b>
        
       @@ -83,7 +83,7 @@ If you are on Rails &lt; 2.1, do this from your RAILS_ROOT
        == Performance
        
        To achieve best performance, you should add indices to your tables on the date columns that are
       -used for grouping the records (see Kvlr::ReportsAsSparkline::ClassMethods.reports_as_sparkline):
       +used for grouping the records (see Simplabs::ReportsAsSparkline::ClassMethods.reports_as_sparkline):
        
          add_index :[table], :[date_column]
        
       @@ -103,4 +103,10 @@ If you are on PostgreSQL, you should add functional indices:
        
        If you want ot suggest any new features or report bugs, do so at http://simplabs.lighthouseapp.com/projects/21060-reportsassparkline/overview.
        
       -© 2008-2009 Martin Kavalar, Marco Otte-Witte (http://simplabs.com/#projects), released under the MIT license
       +== Contributors
       +
       +* myronmarston (http://github.com/myronmarston)
       +
       +== Author
       +
       +© 2008-2009 Marco Otte-Witte (http://simplabs.com/#projects), Martin Kavalar, released under the MIT license
 (DIR) diff --git a/init.rb b/init.rb
       @@ -1,9 +1,9 @@
       -require 'kvlr/reports_as_sparkline'
       +require 'simplabs/reports_as_sparkline'
        
        ActiveRecord::Base.class_eval do
       -  include Kvlr::ReportsAsSparkline
       +  include Simplabs::ReportsAsSparkline
        end
        
        ActionView::Base.class_eval do
       -  include Kvlr::ReportsAsSparkline::SparklineTagHelper
       +  include Simplabs::ReportsAsSparkline::SparklineTagHelper
        end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline.rb b/lib/kvlr/reports_as_sparkline.rb
       @@ -1,57 +0,0 @@
       -module Kvlr #:nodoc:
       -
       -  module ReportsAsSparkline
       -
       -    def self.included(base) #:nodoc:
       -      base.extend ClassMethods
       -    end
       -
       -    module ClassMethods
       -
       -      # Generates a report on a model. That report can then be executed via the new method <name>_report (see documentation of Kvlr::ReportsAsSparkline::Report#run).
       -      # 
       -      # ==== Parameters
       -      #
       -      # * <tt>name</tt> - The name of the report, defines the name of the generated report method (<name>_report)
       -      #
       -      # ==== Options
       -      #
       -      # * <tt>:date_column</tt> - The name of the date column on that the records are aggregated
       -      # * <tt>:value_column</tt> - The name of the column that holds the value to sum for aggregation :sum
       -      # * <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>)
       -      # * <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>
       -      # * <tt>:limit</tt> - The number of periods to get (see :grouping)
       -      # * <tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; only records that match there conditions are reported on
       -      # * <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)
       -      #
       -      # ==== Examples
       -      #
       -      #  class Game < ActiveRecord::Base
       -      #    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_column => :activated_at
       -      #    reports_as_sparkline :total_users,   :cumulate => true
       -      #    reports_as_sparkline :rake,          :aggregation => :sum,   :value_column => :profile_visits
       -      #  end
       -      def reports_as_sparkline(name, options = {})
       -        (class << self; self; end).instance_eval do
       -          define_method "#{name.to_s}_report".to_sym do |*args|
       -            if options.delete(:cumulate)
       -              report = Kvlr::ReportsAsSparkline::CumulatedReport.new(self, name, options)
       -            else
       -              report = Kvlr::ReportsAsSparkline::Report.new(self, name, options)
       -            end
       -            raise ArgumentError.new unless args.length == 0 || (args.length == 1 && args[0].is_a?(Hash))
       -            report.run(args.length == 0 ? {} : args[0])
       -          end
       -        end
       -      end
       -
       -    end
       -
       -  end
       -
       -end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/cumulated_report.rb b/lib/kvlr/reports_as_sparkline/cumulated_report.rb
       @@ -1,45 +0,0 @@
       -module Kvlr #:nodoc:
       -
       -  module ReportsAsSparkline #:nodoc:
       -
       -    # A special report class that cumulates all data (see Kvlr::ReportsAsSparkline::Report)
       -    #
       -    # ==== Examples
       -    #
       -    #  When Kvlr::ReportsAsSparkline::Report returns
       -    #
       -    #    [[<DateTime today>, 1], [<DateTime yesterday>, 2], etc.]
       -    #
       -    #  Kvlr::ReportsAsSparkline::CumulatedReport returns
       -    #
       -    #    [[<DateTime today>, 3], [<DateTime yesterday>, 2], etc.]
       -    class CumulatedReport < Report
       -
       -      # Runs the report (see Kvlr::ReportsAsSparkline::Report#run)
       -      def run(options = {})
       -        cumulate(super, options_for_run(options))
       -      end
       -
       -      protected
       -
       -        def cumulate(data, options) #:nodoc:
       -          first_reporting_period = ReportingPeriod.first(options[:grouping], options[:limit], options[:end_date])
       -          acc = initial_cumulative_value(first_reporting_period.date_time, options)
       -          result = []
       -          data.each do |element|
       -            acc += element[1].to_f
       -            result << [element[0], acc]
       -          end
       -          result
       -        end
       -
       -        def initial_cumulative_value(date, options)
       -          conditions = setup_conditions(nil, date, options[:conditions])
       -          @klass.send(@aggregation, @value_column, :conditions => conditions)
       -        end
       -
       -    end
       -
       -  end
       -
       -end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/grouping.rb b/lib/kvlr/reports_as_sparkline/grouping.rb
       @@ -1,119 +0,0 @@
       -module Kvlr #:nodoc:
       -
       -  module ReportsAsSparkline #:nodoc:
       -
       -    # This is the grouping a report uses to group records in the database
       -    class Grouping
       -
       -      # ==== Parameters
       -      # * <tt>identifier</tt> - The identifier of the grouping - one of :hour, :day, :week or :month
       -      def initialize(identifier)
       -        raise ArgumentError.new("Invalid grouping #{identifier}") unless [:hour, :day, :week, :month].include?(identifier)
       -        @identifier = identifier
       -      end
       -
       -      # Returns the Grouping's identifier
       -      def identifier
       -        @identifier
       -      end
       -
       -      def date_parts_from_db_string(db_string) #:nodoc:
       -        return case ActiveRecord::Base.connection.adapter_name
       -          when /mysql/i
       -            from_mysql_db_string(db_string)
       -          when /sqlite/i
       -            from_sqlite_db_string(db_string)
       -          when /postgres/i
       -            from_postgresql_db_string(db_string)
       -        end
       -      end
       -
       -      def to_sql(date_column) #:nodoc:
       -        return case ActiveRecord::Base.connection.adapter_name
       -          when /mysql/i
       -            mysql_format(date_column)
       -          when /sqlite/i
       -            sqlite_format(date_column)
       -          when /postgres/i
       -            postgresql_format(date_column)
       -        end
       -      end
       -
       -      private
       -
       -        def from_mysql_db_string(db_string)
       -          if @identifier == :week
       -            parts = [db_string[0..3], db_string[4..5]].map(&:to_i)
       -          else
       -            db_string.split('/').map(&:to_i)
       -          end
       -        end
       -
       -        def from_sqlite_db_string(db_string)
       -          if @identifier == :week
       -            parts = db_string.split('-').map(&:to_i)
       -            date = Date.new(parts[0], parts[1], parts[2])
       -            return [date.cwyear, date.cweek]
       -          end
       -          db_string.split('/').map(&:to_i)
       -        end
       -
       -        def from_postgresql_db_string(db_string)
       -          case @identifier
       -            when :hour
       -              return (db_string[0..9].split('-') + [db_string[11..12]]).map(&:to_i)
       -            when :day
       -              return db_string[0..9].split('-').map(&:to_i)
       -            when :week
       -              parts = db_string[0..9].split('-').map(&:to_i)
       -              date = Date.new(parts[0], parts[1], parts[2])
       -              return [date.cwyear, date.cweek]
       -            when :month
       -              return db_string[0..6].split('-')[0..1].map(&:to_i)
       -          end
       -        end
       -
       -        def mysql_format(date_column)
       -          return case @identifier
       -            when :hour
       -              "DATE_FORMAT(#{date_column}, '%Y/%m/%d/%H')"
       -            when :day
       -              "DATE_FORMAT(#{date_column}, '%Y/%m/%d')"
       -            when :week
       -              "YEARWEEK(#{date_column}, 3)"
       -            when :month
       -              "DATE_FORMAT(#{date_column}, '%Y/%m')"
       -          end
       -        end
       -
       -        def sqlite_format(date_column)
       -          return case @identifier
       -            when :hour
       -              "strftime('%Y/%m/%d/%H', #{date_column})"
       -            when :day
       -              "strftime('%Y/%m/%d', #{date_column})"
       -            when :week
       -              "date(#{date_column}, 'weekday 0')"
       -            when :month
       -              "strftime('%Y/%m', #{date_column})"
       -          end
       -        end
       -
       -        def postgresql_format(date_column)
       -          return case @identifier
       -            when :hour
       -              "date_trunc('hour', #{date_column})"
       -            when :day
       -              "date_trunc('day', #{date_column})"
       -            when :week
       -              "date_trunc('week', #{date_column})"
       -            when :month
       -              "date_trunc('month', #{date_column})"
       -          end
       -        end
       -
       -    end
       -
       -  end
       -
       -end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/report.rb b/lib/kvlr/reports_as_sparkline/report.rb
       @@ -1,131 +0,0 @@
       -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, :value_column, :aggregation, :options
       -
       -      # ==== Parameters
       -      # * <tt>klass</tt> - The model the report works on (This is the class you invoke Kvlr::ReportsAsSparkline::ClassMethods#reports_as_sparkline on)
       -      # * <tt>name</tt> - The name of the report (as in Kvlr::ReportsAsSparkline::ClassMethods#reports_as_sparkline)
       -      #
       -      # ==== Options
       -      #
       -      # * <tt>:date_column</tt> - The name of the date column on that the records are aggregated
       -      # * <tt>:value_column</tt> - The name of the column that holds the value to sum for aggregation :sum
       -      # * <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>)
       -      # * <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>
       -      # * <tt>:limit</tt> - The number of periods to get (see :grouping)
       -      # * <tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; only records that match there conditions are reported on
       -      # * <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)
       -      # * <tt>:end_date</tt> - When specified, the report will be for the periods before this date.
       -      def initialize(klass, name, options = {})
       -        ensure_valid_options(options)
       -        @klass        = klass
       -        @name         = name
       -        @date_column  = (options[:date_column] || 'created_at').to_s
       -        @aggregation  = options[:aggregation] || :count
       -        @value_column = (options[:value_column] || (@aggregation == :count ? 'id' : name)).to_s
       -        @options = {
       -          :limit      => options[:limit] || 100,
       -          :conditions => options[:conditions] || [],
       -          :grouping   => Grouping.new(options[:grouping] || :day),
       -          :live_data  => options[:live_data] || false,
       -          :end_date   => options[:end_date]
       -        }
       -        @options.merge!(options)
       -        @options.freeze
       -      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; only records that match there conditions are reported on (<b>Beware that when you specify conditions here, caching will be disabled</b>)
       -      # * <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>
       -      # * <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)
       -      # * <tt>:end_date</tt> - When specified, the report will be for the periods before this date.
       -      def run(options = {})
       -        custom_conditions = options.key?(:conditions)
       -        options = options_for_run(options)
       -        ReportCache.process(self, options, !custom_conditions) do |begin_at, end_at|
       -          read_data(begin_at, end_at, options)
       -        end
       -      end
       -
       -      private
       -
       -        def options_for_run(options = {})
       -          options = options.dup
       -          ensure_valid_options(options, :run)
       -          options.reverse_merge!(@options)
       -          options[:grouping] = Grouping.new(options[:grouping]) unless options[:grouping].is_a?(Grouping)
       -          return options
       -        end
       -
       -        def read_data(begin_at, end_at, options)
       -          conditions = setup_conditions(begin_at, end_at, options[:conditions])
       -          @klass.send(@aggregation,
       -            @value_column,
       -            :conditions => conditions,
       -            :group => options[:grouping].to_sql(@date_column),
       -            :order => "#{options[:grouping].to_sql(@date_column)} ASC"
       -          )
       -        end
       -
       -        def setup_conditions(begin_at, end_at, custom_conditions = [])
       -          conditions = ['']
       -          if custom_conditions.is_a?(Hash)
       -            conditions = [custom_conditions.map do |k, v|
       -              if v.nil?
       -                "#{k.to_s} IS NULL"
       -              elsif v.is_a?(Array) || v.is_a?(Range)
       -                "#{k.to_s} IN (?)"
       -              else
       -                "#{k.to_s} = ?"
       -              end
       -            end.join(' AND '), *custom_conditions.map { |k, v| v }.compact]
       -          elsif custom_conditions.size > 0
       -            conditions = [(custom_conditions[0] || ''), *custom_conditions[1..-1]]
       -          end
       -          conditions[0] += "#{(conditions[0].blank? ? '' : ' AND ') + @date_column.to_s} "
       -
       -          conditions[0] += if begin_at && end_at
       -            'BETWEEN ? AND ?'
       -          elsif begin_at
       -            '>= ?'
       -          elsif end_at
       -            '<= ?'
       -          else
       -            raise ArgumentError.new('You must pass either begin_at, end_at or both to setup_conditions.')
       -          end
       -
       -          conditions << begin_at if begin_at
       -          conditions << end_at if end_at
       -          conditions
       -        end
       -
       -        def ensure_valid_options(options, context = :initialize)
       -          case context
       -            when :initialize
       -              options.each_key do |k|
       -                raise ArgumentError.new("Invalid option #{k}") unless [:limit, :aggregation, :grouping, :date_column, :value_column, :conditions, :live_data, :end_date].include?(k)
       -              end
       -              raise ArgumentError.new("Invalid aggregation #{options[:aggregation]}") if options[:aggregation] && ![:count, :sum, :maximum, :minimum, :average].include?(options[:aggregation])
       -              raise ArgumentError.new('The name of the column holding the value to sum has to be specified for aggregation :sum') if [:sum, :maximum, :minimum, :average].include?(options[:aggregation]) && !options.key?(:value_column)
       -            when :run
       -              options.each_key do |k|
       -                raise ArgumentError.new("Invalid option #{k}") unless [:limit, :conditions, :grouping, :live_data, :end_date].include?(k)
       -              end
       -          end
       -          raise ArgumentError.new("Invalid grouping #{options[:grouping]}") if options[:grouping] && ![:hour, :day, :week, :month].include?(options[:grouping])
       -          raise ArgumentError.new("Invalid conditions: #{options[:conditions].inspect}") if options[:conditions] && !options[:conditions].is_a?(Array) && !options[:conditions].is_a?(Hash)
       -        end
       -
       -    end
       -
       -  end
       -
       -end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/report_cache.rb b/lib/kvlr/reports_as_sparkline/report_cache.rb
       @@ -1,122 +0,0 @@
       -module Kvlr #:nodoc:
       -
       -  module ReportsAsSparkline #:nodoc:
       -
       -    class ReportCache < ActiveRecord::Base #:nodoc:
       -
       -      def self.process(report, options, cache = true, &block)
       -        raise ArgumentError.new('A block must be given') unless block_given?
       -        self.transaction do
       -          cached_data = []
       -          first_reporting_period = ReportingPeriod.first(options[:grouping], options[:limit], options[:end_date])
       -          last_reporting_period = options[:end_date] ? ReportingPeriod.new(options[:grouping], options[:end_date]) : nil
       -
       -          if cache
       -            cached_data = find_cached_data(report, options, first_reporting_period, last_reporting_period)
       -            first_cached_reporting_period = cached_data.empty? ? nil : ReportingPeriod.new(options[:grouping], cached_data.first.reporting_period)
       -            last_cached_reporting_period = cached_data.empty? ? nil : ReportingPeriod.new(options[:grouping], cached_data.last.reporting_period)
       -          end
       -
       -          # Get any missing data that comes after our cached data...
       -          new_after_cache_data = if !options[:live_data] && last_cached_reporting_period == ReportingPeriod.new(options[:grouping]).previous
       -            []
       -          else
       -            end_date = options[:live_data] ? nil : last_reporting_period && last_reporting_period.date_time
       -            yield((last_cached_reporting_period.next rescue first_reporting_period).date_time, end_date)
       -          end
       -
       -          # Get any mising data that comes before our cached data....
       -          new_before_cache_data = if cached_data.empty? || # after_cache_data will contain all the data if the cache was empty.
       -            first_cached_reporting_period.date_time == first_reporting_period.date_time
       -            []
       -          else
       -            yield(first_reporting_period.date_time, first_cached_reporting_period.date_time)
       -          end
       -
       -          prepare_result(new_before_cache_data, new_after_cache_data, cached_data, report, options, cache)
       -        end
       -      end
       -
       -      private
       -
       -        def self.prepare_result(new_before_cache_data, new_after_cache_data, cached_data, report, options, cache = true)
       -          cache_map_proc = lambda { |data| [ReportingPeriod.from_db_string(options[:grouping], data[0]), data[1]] }
       -
       -          new_after_cache_data = new_after_cache_data.map &cache_map_proc
       -          new_before_cache_data = new_before_cache_data.map &cache_map_proc
       -          result = cached_data.map { |cached| [cached.reporting_period, cached.value] }
       -
       -          first_reporting_period = ReportingPeriod.first(options[:grouping], options[:limit], options[:end_date])
       -          last_reporting_period = ReportingPeriod.new(options[:grouping], options[:end_date])
       -          first_cached_reporting_period = cached_data.empty? ? nil : ReportingPeriod.new(options[:grouping], cached_data.first.reporting_period)
       -          last_cached_reporting_period = cached_data.empty? ? nil : ReportingPeriod.new(options[:grouping], cached_data.last.reporting_period)
       -
       -          if first_cached_reporting_period
       -            reporting_period = first_reporting_period
       -            while reporting_period < first_cached_reporting_period
       -              cached = build_cached_data(report, options[:grouping], reporting_period, find_value(new_before_cache_data, reporting_period))
       -              cached.save! if cache
       -              result.insert(0, [reporting_period.date_time, cached.value])
       -              reporting_period = reporting_period.next
       -            end
       -          end
       -
       -          reporting_period = cached_data.empty? ? first_reporting_period : last_cached_reporting_period.next
       -
       -          while reporting_period < last_reporting_period
       -            cached = build_cached_data(report, options[:grouping], reporting_period, find_value(new_after_cache_data, reporting_period))
       -            cached.save! if cache
       -            result << [reporting_period.date_time, cached.value]
       -            reporting_period = reporting_period.next
       -          end
       -
       -          if options[:live_data]
       -            result << [last_reporting_period.date_time, find_value(new_after_cache_data, last_reporting_period)]
       -          end
       -          result
       -        end
       -
       -        def self.find_value(data, reporting_period)
       -          data = data.detect { |d| d[0] == reporting_period }
       -          data ? data[1] : 0.0
       -        end
       -
       -        def self.build_cached_data(report, grouping, reporting_period, value)
       -          self.new(
       -            :model_name       => report.klass.to_s,
       -            :report_name      => report.name.to_s,
       -            :grouping         => grouping.identifier.to_s,
       -            :aggregation      => report.aggregation.to_s,
       -            :reporting_period => reporting_period.date_time,
       -            :value            => value
       -          )
       -        end
       -
       -        def self.find_cached_data(report, options, first_reporting_period, last_reporting_period)
       -          conditions = [
       -            'model_name = ? AND report_name = ? AND grouping = ? AND aggregation = ? AND reporting_period >= ?',
       -            report.klass.to_s,
       -            report.name.to_s,
       -            options[:grouping].identifier.to_s,
       -            report.aggregation.to_s,
       -            first_reporting_period.date_time
       -          ]
       -
       -          if last_reporting_period
       -            conditions.first.sub!(/>= \?\z/, 'BETWEEN ? AND ?')
       -            conditions << last_reporting_period.date_time
       -          end
       -
       -          self.find(
       -            :all,
       -            :conditions => conditions,
       -            :limit => options[:limit],
       -            :order => 'reporting_period ASC'
       -          )
       -        end
       -
       -    end
       -
       -  end
       -
       -end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/reporting_period.rb b/lib/kvlr/reports_as_sparkline/reporting_period.rb
       @@ -1,90 +0,0 @@
       -module Kvlr #:nodoc:
       -
       -  module ReportsAsSparkline #:nodoc:
       -
       -    # A ReportingPeriod is  - depending on the Grouping - either a specific hour, a day, a month or a year. All records falling into this period will be grouped together.
       -    class ReportingPeriod
       -
       -      attr_reader :date_time, :grouping
       -
       -      # ==== Parameters
       -      # * <tt>grouping</tt> - The Kvlr::ReportsAsSparkline::Grouping of the reporting period
       -      # * <tt>date_time</tt> - The DateTime that reporting period is created for
       -      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. the first reporting period for Grouping :day and limit 2 would be Time.now - 2.days
       -      #
       -      # ==== Parameters
       -      # * <tt>grouping</tt> - The Kvlr::ReportsAsSparkline::Grouping of the reporting period
       -      # * <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:
       -        parts = grouping.date_parts_from_db_string(db_string)
       -        result = case grouping.identifier
       -          when :hour
       -            self.new(grouping, DateTime.new(parts[0], parts[1], parts[2], parts[3], 0, 0))
       -          when :day
       -            self.new(grouping, Date.new(parts[0], parts[1], parts[2]))
       -          when :week
       -            self.new(grouping, Date.commercial(parts[0], parts[1], 1))
       -          when :month
       -            self.new(grouping, Date.new(parts[0], parts[1], 1))
       -        end
       -        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/year)
       -      def previous
       -        self.offset(-1)
       -      end
       -      
       -      def offset(val)
       -        self.class.new(@grouping, @date_time + val.send(@grouping.identifier))
       -      end
       -
       -      def ==(other) #:nodoc:
       -        if other.class == Kvlr::ReportsAsSparkline::ReportingPeriod
       -          return @date_time.to_s == other.date_time.to_s && @grouping.identifier.to_s == other.grouping.identifier.to_s
       -        end
       -        false
       -      end
       -
       -      def <(other) #:nodoc:
       -        if other.class == Kvlr::ReportsAsSparkline::ReportingPeriod
       -          return @date_time < other.date_time
       -        end
       -        raise ArgumentError.new("Can only compare instances of #{Kvlr::ReportsAsSparkline::ReportingPeriod.klass}")
       -      end
       -
       -      private
       -
       -        def parse_date_time(date_time)
       -          return case @grouping.identifier
       -            when :hour
       -              DateTime.new(date_time.year, date_time.month, date_time.day, date_time.hour)
       -            when :day
       -              date_time.to_date
       -            when :week
       -              date_time = (date_time - date_time.wday.days) + 1.day
       -              Date.new(date_time.year, date_time.month, date_time.day)
       -            when :month
       -              Date.new(date_time.year, date_time.month, 1)
       -          end
       -        end
       -
       -    end
       -
       -  end
       -
       -end
 (DIR) diff --git a/lib/kvlr/reports_as_sparkline/sparkline_tag_helper.rb b/lib/kvlr/reports_as_sparkline/sparkline_tag_helper.rb
       @@ -1,39 +0,0 @@
       -module Kvlr #:nodoc:
       -
       -  module ReportsAsSparkline #:nodoc:
       -
       -    module SparklineTagHelper
       -
       -      # Renders a sparkline with the given data.
       -      #
       -      # ==== Parameters
       -      #
       -      # * <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>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 (hex code)
       -      # * <tt>labels</tt> - The axes to render lables for (Array of :x, :y, :r, :t; this is x axis, y axis, right, top)
       -      #
       -      # ==== Example
       -      # <%= sparkline_tag(User.registrations_report, :width => 200, :height => 100, :color => '000') %>
       -      def sparkline_tag(data, options = {})
       -        options.reverse_merge!({ :width => 300, :height => 34, :line_color => '0077cc', :fill_color => 'e6f2fa', :labels => [] })
       -        data = data.collect { |d| d[1] }
       -        labels = ""
       -        unless options[:labels].empty?
       -          labels = "&chxt=#{options[:labels].map(&:to_s).join(',')}&chxr=0,0,#{data.length}|1,0,#{data.max}|2,0,#{data.max}|3,0,#{data.length}"
       -        end
       -        image_tag(
       -          "http://chart.apis.google.com/chart?cht=ls&chs=#{options[:width]}x#{options[:height]}&chd=t:#{data.join(',')}&chco=#{options[:line_color]}&chm=B,#{options[:fill_color]},0,0,0&chls=1,0,0&chds=#{data.min},#{data.max}#{labels}"
       -        )
       -      end
       -
       -    end
       -
       -  end
       -
       -end
 (DIR) diff --git a/lib/simplabs/reports_as_sparkline.rb b/lib/simplabs/reports_as_sparkline.rb
       @@ -0,0 +1,58 @@
       +module Simplabs #:nodoc:
       +
       +  module ReportsAsSparkline
       +
       +    def self.included(base) #:nodoc:
       +      base.extend ClassMethods
       +    end
       +
       +    module ClassMethods
       +
       +      # Generates a report on a model. That report can then be executed via the new method <name>_report (see documentation of Simplabs::ReportsAsSparkline::Report#run).
       +      # 
       +      # ==== Parameters
       +      #
       +      # * <tt>name</tt> - The name of the report, defines the name of the generated report method (<name>_report)
       +      #
       +      # ==== Options
       +      #
       +      # * <tt>:date_column</tt> - The name of the date column on that the records are aggregated
       +      # * <tt>:value_column</tt> - The name of the column that holds the value to sum for aggregation :sum
       +      # * <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>)
       +      # * <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>
       +      # * <tt>:limit</tt> - The number of periods to get (see :grouping)
       +      # * <tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; only records that match there conditions are reported on
       +      # * <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)
       +      # * <tt>:end_date</tt> - When specified, the report will only include data for the periods before this date.
       +      #
       +      # ==== Examples
       +      #
       +      #  class Game < ActiveRecord::Base
       +      #    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_column => :activated_at
       +      #    reports_as_sparkline :total_users,   :cumulate => true
       +      #    reports_as_sparkline :rake,          :aggregation => :sum,   :value_column => :profile_visits
       +      #  end
       +      def reports_as_sparkline(name, options = {})
       +        (class << self; self; end).instance_eval do
       +          define_method "#{name.to_s}_report".to_sym do |*args|
       +            if options.delete(:cumulate)
       +              report = Simplabs::ReportsAsSparkline::CumulatedReport.new(self, name, options)
       +            else
       +              report = Simplabs::ReportsAsSparkline::Report.new(self, name, options)
       +            end
       +            raise ArgumentError.new unless args.length == 0 || (args.length == 1 && args[0].is_a?(Hash))
       +            report.run(args.length == 0 ? {} : args[0])
       +          end
       +        end
       +      end
       +
       +    end
       +
       +  end
       +
       +end
 (DIR) diff --git a/lib/simplabs/reports_as_sparkline/cumulated_report.rb b/lib/simplabs/reports_as_sparkline/cumulated_report.rb
       @@ -0,0 +1,45 @@
       +module Simplabs #:nodoc:
       +
       +  module ReportsAsSparkline #:nodoc:
       +
       +    # A special report class that cumulates all data (see Simplabs::ReportsAsSparkline::Report)
       +    #
       +    # ==== Examples
       +    #
       +    #  When Simplabs::ReportsAsSparkline::Report returns
       +    #
       +    #    [[<DateTime today>, 1], [<DateTime yesterday>, 2], etc.]
       +    #
       +    #  Simplabs::ReportsAsSparkline::CumulatedReport returns
       +    #
       +    #    [[<DateTime today>, 3], [<DateTime yesterday>, 2], etc.]
       +    class CumulatedReport < Report
       +
       +      # Runs the report (see Simplabs::ReportsAsSparkline::Report#run)
       +      def run(options = {})
       +        cumulate(super, options_for_run(options))
       +      end
       +
       +      protected
       +
       +        def cumulate(data, options) #:nodoc:
       +          first_reporting_period = ReportingPeriod.first(options[:grouping], options[:limit], options[:end_date])
       +          acc = initial_cumulative_value(first_reporting_period.date_time, options)
       +          result = []
       +          data.each do |element|
       +            acc += element[1].to_f
       +            result << [element[0], acc]
       +          end
       +          result
       +        end
       +
       +        def initial_cumulative_value(date, options)
       +          conditions = setup_conditions(nil, date, options[:conditions])
       +          @klass.send(@aggregation, @value_column, :conditions => conditions)
       +        end
       +
       +    end
       +
       +  end
       +
       +end
 (DIR) diff --git a/lib/simplabs/reports_as_sparkline/grouping.rb b/lib/simplabs/reports_as_sparkline/grouping.rb
       @@ -0,0 +1,119 @@
       +module Simplabs #:nodoc:
       +
       +  module ReportsAsSparkline #:nodoc:
       +
       +    # This is the grouping a report uses to group records in the database
       +    class Grouping
       +
       +      # ==== Parameters
       +      # * <tt>identifier</tt> - The identifier of the grouping - one of :hour, :day, :week or :month
       +      def initialize(identifier)
       +        raise ArgumentError.new("Invalid grouping #{identifier}") unless [:hour, :day, :week, :month].include?(identifier)
       +        @identifier = identifier
       +      end
       +
       +      # Returns the Grouping's identifier
       +      def identifier
       +        @identifier
       +      end
       +
       +      def date_parts_from_db_string(db_string) #:nodoc:
       +        return case ActiveRecord::Base.connection.adapter_name
       +          when /mysql/i
       +            from_mysql_db_string(db_string)
       +          when /sqlite/i
       +            from_sqlite_db_string(db_string)
       +          when /postgres/i
       +            from_postgresql_db_string(db_string)
       +        end
       +      end
       +
       +      def to_sql(date_column) #:nodoc:
       +        return case ActiveRecord::Base.connection.adapter_name
       +          when /mysql/i
       +            mysql_format(date_column)
       +          when /sqlite/i
       +            sqlite_format(date_column)
       +          when /postgres/i
       +            postgresql_format(date_column)
       +        end
       +      end
       +
       +      private
       +
       +        def from_mysql_db_string(db_string)
       +          if @identifier == :week
       +            parts = [db_string[0..3], db_string[4..5]].map(&:to_i)
       +          else
       +            db_string.split('/').map(&:to_i)
       +          end
       +        end
       +
       +        def from_sqlite_db_string(db_string)
       +          if @identifier == :week
       +            parts = db_string.split('-').map(&:to_i)
       +            date = Date.new(parts[0], parts[1], parts[2])
       +            return [date.cwyear, date.cweek]
       +          end
       +          db_string.split('/').map(&:to_i)
       +        end
       +
       +        def from_postgresql_db_string(db_string)
       +          case @identifier
       +            when :hour
       +              return (db_string[0..9].split('-') + [db_string[11..12]]).map(&:to_i)
       +            when :day
       +              return db_string[0..9].split('-').map(&:to_i)
       +            when :week
       +              parts = db_string[0..9].split('-').map(&:to_i)
       +              date = Date.new(parts[0], parts[1], parts[2])
       +              return [date.cwyear, date.cweek]
       +            when :month
       +              return db_string[0..6].split('-')[0..1].map(&:to_i)
       +          end
       +        end
       +
       +        def mysql_format(date_column)
       +          return case @identifier
       +            when :hour
       +              "DATE_FORMAT(#{date_column}, '%Y/%m/%d/%H')"
       +            when :day
       +              "DATE_FORMAT(#{date_column}, '%Y/%m/%d')"
       +            when :week
       +              "YEARWEEK(#{date_column}, 3)"
       +            when :month
       +              "DATE_FORMAT(#{date_column}, '%Y/%m')"
       +          end
       +        end
       +
       +        def sqlite_format(date_column)
       +          return case @identifier
       +            when :hour
       +              "strftime('%Y/%m/%d/%H', #{date_column})"
       +            when :day
       +              "strftime('%Y/%m/%d', #{date_column})"
       +            when :week
       +              "date(#{date_column}, 'weekday 0')"
       +            when :month
       +              "strftime('%Y/%m', #{date_column})"
       +          end
       +        end
       +
       +        def postgresql_format(date_column)
       +          return case @identifier
       +            when :hour
       +              "date_trunc('hour', #{date_column})"
       +            when :day
       +              "date_trunc('day', #{date_column})"
       +            when :week
       +              "date_trunc('week', #{date_column})"
       +            when :month
       +              "date_trunc('month', #{date_column})"
       +          end
       +        end
       +
       +    end
       +
       +  end
       +
       +end
 (DIR) diff --git a/lib/simplabs/reports_as_sparkline/report.rb b/lib/simplabs/reports_as_sparkline/report.rb
       @@ -0,0 +1,129 @@
       +module Simplabs #:nodoc:
       +
       +  module ReportsAsSparkline #:nodoc:
       +
       +    # The Report class that does all the data retrieval and calculations
       +    class Report
       +
       +      attr_reader :klass, :name, :date_column, :value_column, :aggregation, :options
       +
       +      # ==== Parameters
       +      # * <tt>klass</tt> - The model the report works on (This is the class you invoke Simplabs::ReportsAsSparkline::ClassMethods#reports_as_sparkline on)
       +      # * <tt>name</tt> - The name of the report (as in Simplabs::ReportsAsSparkline::ClassMethods#reports_as_sparkline)
       +      #
       +      # ==== Options
       +      #
       +      # * <tt>:date_column</tt> - The name of the date column on that the records are aggregated
       +      # * <tt>:value_column</tt> - The name of the column that holds the value to sum for aggregation :sum
       +      # * <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>)
       +      # * <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>
       +      # * <tt>:limit</tt> - The number of periods to get (see :grouping)
       +      # * <tt>:conditions</tt> - Conditions like in ActiveRecord::Base#find; only records that match there conditions are reported on
       +      # * <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)
       +      # * <tt>:end_date</tt> - When specified, the report will only include data for the periods before this date.
       +      def initialize(klass, name, options = {})
       +        ensure_valid_options(options)
       +        @klass        = klass
       +        @name         = name
       +        @date_column  = (options[:date_column] || 'created_at').to_s
       +        @aggregation  = options[:aggregation] || :count
       +        @value_column = (options[:value_column] || (@aggregation == :count ? 'id' : name)).to_s
       +        @options = {
       +          :limit      => options[:limit] || 100,
       +          :conditions => options[:conditions] || [],
       +          :grouping   => Grouping.new(options[:grouping] || :day),
       +          :live_data  => options[:live_data] || false,
       +          :end_date   => options[:end_date] || false
       +        }
       +        @options.merge!(options)
       +        @options.freeze
       +      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; only records that match there conditions are reported on (<b>Beware that when you specify conditions here, caching will be disabled</b>)
       +      # * <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>
       +      # * <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)
       +      # * <tt>:end_date</tt> - When specified, the report will only include data for the periods before this date.
       +      def run(options = {})
       +        custom_conditions = options.key?(:conditions)
       +        options = options_for_run(options)
       +        ReportCache.process(self, options, !custom_conditions) do |begin_at, end_at|
       +          read_data(begin_at, end_at, options)
       +        end
       +      end
       +
       +      private
       +
       +        def options_for_run(options = {})
       +          options = options.dup
       +          ensure_valid_options(options, :run)
       +          options.reverse_merge!(@options)
       +          options[:grouping] = Grouping.new(options[:grouping]) unless options[:grouping].is_a?(Grouping)
       +          return options
       +        end
       +
       +        def read_data(begin_at, end_at, options)
       +          conditions = setup_conditions(begin_at, end_at, options[:conditions])
       +          @klass.send(@aggregation,
       +            @value_column,
       +            :conditions => conditions,
       +            :group => options[:grouping].to_sql(@date_column),
       +            :order => "#{options[:grouping].to_sql(@date_column)} ASC"
       +          )
       +        end
       +
       +        def setup_conditions(begin_at, end_at, custom_conditions = [])
       +          conditions = ['']
       +          if custom_conditions.is_a?(Hash)
       +            conditions = [custom_conditions.map do |k, v|
       +              if v.nil?
       +                "#{k.to_s} IS NULL"
       +              elsif v.is_a?(Array) || v.is_a?(Range)
       +                "#{k.to_s} IN (?)"
       +              else
       +                "#{k.to_s} = ?"
       +              end
       +            end.join(' AND '), *custom_conditions.map { |k, v| v }.compact]
       +          elsif custom_conditions.size > 0
       +            conditions = [(custom_conditions[0] || ''), *custom_conditions[1..-1]]
       +          end
       +          conditions[0] += "#{(conditions[0].blank? ? '' : ' AND ') + @date_column.to_s} "
       +          conditions[0] += if begin_at && end_at
       +            'BETWEEN ? AND ?'
       +          elsif begin_at
       +            '>= ?'
       +          elsif end_at
       +            '<= ?'
       +          else
       +            raise ArgumentError.new('You must pass either begin_at, end_at or both to setup_conditions.')
       +          end
       +          conditions << begin_at if begin_at
       +          conditions << end_at if end_at
       +          conditions
       +        end
       +
       +        def ensure_valid_options(options, context = :initialize)
       +          case context
       +            when :initialize
       +              options.each_key do |k|
       +                raise ArgumentError.new("Invalid option #{k}") unless [:limit, :aggregation, :grouping, :date_column, :value_column, :conditions, :live_data, :end_date].include?(k)
       +              end
       +              raise ArgumentError.new("Invalid aggregation #{options[:aggregation]}") if options[:aggregation] && ![:count, :sum, :maximum, :minimum, :average].include?(options[:aggregation])
       +              raise ArgumentError.new('The name of the column holding the value to sum has to be specified for aggregation :sum') if [:sum, :maximum, :minimum, :average].include?(options[:aggregation]) && !options.key?(:value_column)
       +            when :run
       +              options.each_key do |k|
       +                raise ArgumentError.new("Invalid option #{k}") unless [:limit, :conditions, :grouping, :live_data, :end_date].include?(k)
       +              end
       +          end
       +          raise ArgumentError.new("Invalid grouping #{options[:grouping]}") if options[:grouping] && ![:hour, :day, :week, :month].include?(options[:grouping])
       +          raise ArgumentError.new("Invalid conditions: #{options[:conditions].inspect}") if options[:conditions] && !options[:conditions].is_a?(Array) && !options[:conditions].is_a?(Hash)
       +        end
       +
       +    end
       +
       +  end
       +
       +end
 (DIR) diff --git a/lib/simplabs/reports_as_sparkline/report_cache.rb b/lib/simplabs/reports_as_sparkline/report_cache.rb
       @@ -0,0 +1,116 @@
       +module Simplabs #:nodoc:
       +
       +  module ReportsAsSparkline #:nodoc:
       +
       +    class ReportCache < ActiveRecord::Base #:nodoc:
       +
       +      def self.process(report, options, cache = true, &block)
       +        raise ArgumentError.new('A block must be given') unless block_given?
       +        self.transaction do
       +          cached_data = []
       +          first_reporting_period = ReportingPeriod.first(options[:grouping], options[:limit], options[:end_date])
       +          last_reporting_period = options[:end_date] ? ReportingPeriod.new(options[:grouping], options[:end_date]) : nil
       +          if cache
       +            cached_data = find_cached_data(report, options, first_reporting_period, last_reporting_period)
       +            first_cached_reporting_period = cached_data.empty? ? nil : ReportingPeriod.new(options[:grouping], cached_data.first.reporting_period)
       +            last_cached_reporting_period = cached_data.empty? ? nil : ReportingPeriod.new(options[:grouping], cached_data.last.reporting_period)
       +          end
       +          new_after_cache_data = if !options[:live_data] && last_cached_reporting_period == ReportingPeriod.new(options[:grouping]).previous
       +            []
       +          else
       +            end_date = options[:live_data] ? nil : last_reporting_period && last_reporting_period.date_time
       +            yield((last_cached_reporting_period.next rescue first_reporting_period).date_time, end_date)
       +          end
       +          new_before_cache_data = if cached_data.empty? || first_cached_reporting_period.date_time == first_reporting_period.date_time
       +            []
       +          else
       +            yield(first_reporting_period.date_time, first_cached_reporting_period.date_time)
       +          end
       +          prepare_result(new_before_cache_data, new_after_cache_data, cached_data, report, options, cache)
       +        end
       +      end
       +
       +      private
       +
       +        def self.prepare_result(new_before_cache_data, new_after_cache_data, cached_data, report, options, cache = true)
       +          cache_map_proc = lambda { |data| [ReportingPeriod.from_db_string(options[:grouping], data[0]), data[1]] }
       +
       +          new_after_cache_data = new_after_cache_data.map &cache_map_proc
       +          new_before_cache_data = new_before_cache_data.map &cache_map_proc
       +          result = cached_data.map { |cached| [cached.reporting_period, cached.value] }
       +
       +          first_reporting_period = ReportingPeriod.first(options[:grouping], options[:limit], options[:end_date])
       +          last_reporting_period = ReportingPeriod.new(options[:grouping], options[:end_date])
       +          first_cached_reporting_period = cached_data.empty? ? nil : ReportingPeriod.new(options[:grouping], cached_data.first.reporting_period)
       +          last_cached_reporting_period = cached_data.empty? ? nil : ReportingPeriod.new(options[:grouping], cached_data.last.reporting_period)
       +
       +          if first_cached_reporting_period
       +            reporting_period = first_reporting_period
       +            while reporting_period < first_cached_reporting_period
       +              cached = build_cached_data(report, options[:grouping], reporting_period, find_value(new_before_cache_data, reporting_period))
       +              cached.save! if cache
       +              result.insert(0, [reporting_period.date_time, cached.value])
       +              reporting_period = reporting_period.next
       +            end
       +          end
       +
       +          reporting_period = cached_data.empty? ? first_reporting_period : last_cached_reporting_period.next
       +
       +          while reporting_period < last_reporting_period
       +            cached = build_cached_data(report, options[:grouping], reporting_period, find_value(new_after_cache_data, reporting_period))
       +            cached.save! if cache
       +            result << [reporting_period.date_time, cached.value]
       +            reporting_period = reporting_period.next
       +          end
       +
       +          if options[:live_data]
       +            result << [last_reporting_period.date_time, find_value(new_after_cache_data, last_reporting_period)]
       +          end
       +          result
       +        end
       +
       +        def self.find_value(data, reporting_period)
       +          data = data.detect { |d| d[0] == reporting_period }
       +          data ? data[1] : 0.0
       +        end
       +
       +        def self.build_cached_data(report, grouping, reporting_period, value)
       +          self.new(
       +            :model_name       => report.klass.to_s,
       +            :report_name      => report.name.to_s,
       +            :grouping         => grouping.identifier.to_s,
       +            :aggregation      => report.aggregation.to_s,
       +            :reporting_period => reporting_period.date_time,
       +            :value            => value
       +          )
       +        end
       +
       +        def self.find_cached_data(report, options, first_reporting_period, last_reporting_period)
       +          conditions = [
       +            'model_name = ? AND report_name = ? AND grouping = ? AND aggregation = ?',
       +            report.klass.to_s,
       +            report.name.to_s,
       +            options[:grouping].identifier.to_s,
       +            report.aggregation.to_s
       +          ]
       +          if last_reporting_period
       +            conditions.first << ' AND reporting_period BETWEEN ? AND ?'
       +            conditions << first_reporting_period.date_time
       +            conditions << last_reporting_period.date_time
       +          else
       +            conditions.first << ' AND reporting_period >= ?'
       +            conditions << first_reporting_period.date_time
       +          end
       +          self.find(
       +            :all,
       +            :conditions => conditions,
       +            :limit => options[:limit],
       +            :order => 'reporting_period ASC'
       +          )
       +        end
       +
       +    end
       +
       +  end
       +
       +end
 (DIR) diff --git a/lib/simplabs/reports_as_sparkline/reporting_period.rb b/lib/simplabs/reports_as_sparkline/reporting_period.rb
       @@ -0,0 +1,94 @@
       +module Simplabs #:nodoc:
       +
       +  module ReportsAsSparkline #:nodoc:
       +
       +    # A ReportingPeriod is  - depending on the Grouping - either a specific hour, a day, a month or a year. All records falling into this period will be grouped together.
       +    class ReportingPeriod
       +
       +      attr_reader :date_time, :grouping
       +
       +      # ==== Parameters
       +      # * <tt>grouping</tt> - The Simplabs::ReportsAsSparkline::Grouping of the reporting period
       +      # * <tt>date_time</tt> - The DateTime that reporting period is created for
       +      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. the first reporting period for Grouping :day and limit 2 would be Time.now - 2.days
       +      #
       +      # ==== Parameters
       +      # * <tt>grouping</tt> - The Simplabs::ReportsAsSparkline::Grouping of the reporting period
       +      # * <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:
       +        parts = grouping.date_parts_from_db_string(db_string)
       +        result = case grouping.identifier
       +          when :hour
       +            self.new(grouping, DateTime.new(parts[0], parts[1], parts[2], parts[3], 0, 0))
       +          when :day
       +            self.new(grouping, Date.new(parts[0], parts[1], parts[2]))
       +          when :week
       +            self.new(grouping, Date.commercial(parts[0], parts[1], 1))
       +          when :month
       +            self.new(grouping, Date.new(parts[0], parts[1], 1))
       +        end
       +        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/year)
       +      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 (specifies the offset in hours/days/months/years), depending on the reporting period's grouping
       +      def offset(offset)
       +        self.class.new(@grouping, @date_time + offset.send(@grouping.identifier))
       +      end
       +
       +      def ==(other) #:nodoc:
       +        if other.class == Simplabs::ReportsAsSparkline::ReportingPeriod
       +          return @date_time.to_s == other.date_time.to_s && @grouping.identifier.to_s == other.grouping.identifier.to_s
       +        end
       +        false
       +      end
       +
       +      def <(other) #:nodoc:
       +        if other.class == Simplabs::ReportsAsSparkline::ReportingPeriod
       +          return @date_time < other.date_time
       +        end
       +        raise ArgumentError.new("Can only compare instances of #{Simplabs::ReportsAsSparkline::ReportingPeriod.klass}")
       +      end
       +
       +      private
       +
       +        def parse_date_time(date_time)
       +          return case @grouping.identifier
       +            when :hour
       +              DateTime.new(date_time.year, date_time.month, date_time.day, date_time.hour)
       +            when :day
       +              date_time.to_date
       +            when :week
       +              date_time = (date_time - date_time.wday.days) + 1.day
       +              Date.new(date_time.year, date_time.month, date_time.day)
       +            when :month
       +              Date.new(date_time.year, date_time.month, 1)
       +          end
       +        end
       +
       +    end
       +
       +  end
       +
       +end
 (DIR) diff --git a/lib/simplabs/reports_as_sparkline/sparkline_tag_helper.rb b/lib/simplabs/reports_as_sparkline/sparkline_tag_helper.rb
       @@ -0,0 +1,39 @@
       +module Simplabs #:nodoc:
       +
       +  module ReportsAsSparkline #:nodoc:
       +
       +    module SparklineTagHelper
       +
       +      # Renders a sparkline with the given data.
       +      #
       +      # ==== Parameters
       +      #
       +      # * <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>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 (hex code)
       +      # * <tt>labels</tt> - The axes to render lables for (Array of :x, :y, :r, :t; this is x axis, y axis, right, top)
       +      #
       +      # ==== Example
       +      # <%= sparkline_tag(User.registrations_report, :width => 200, :height => 100, :color => '000') %>
       +      def sparkline_tag(data, options = {})
       +        options.reverse_merge!({ :width => 300, :height => 34, :line_color => '0077cc', :fill_color => 'e6f2fa', :labels => [] })
       +        data = data.collect { |d| d[1] }
       +        labels = ""
       +        unless options[:labels].empty?
       +          labels = "&chxt=#{options[:labels].map(&:to_s).join(',')}&chxr=0,0,#{data.length}|1,0,#{data.max}|2,0,#{data.max}|3,0,#{data.length}"
       +        end
       +        image_tag(
       +          "http://chart.apis.google.com/chart?cht=ls&chs=#{options[:width]}x#{options[:height]}&chd=t:#{data.join(',')}&chco=#{options[:line_color]}&chm=B,#{options[:fill_color]},0,0,0&chls=1,0,0&chds=#{data.min},#{data.max}#{labels}"
       +        )
       +      end
       +
       +    end
       +
       +  end
       +
       +end
 (DIR) diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/ClassMethods.html b/rdoc/classes/Kvlr/ReportsAsSparkline/ClassMethods.html
       @@ -5,7 +5,7 @@
        
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
       -  <title>Module: Kvlr::ReportsAsSparkline::ClassMethods</title>
       +  <title>Module: Simplabs::ReportsAsSparkline::ClassMethods</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" media="screen" />
       @@ -50,13 +50,13 @@
                <table class="header-table">
                <tr class="top-aligned-row">
                  <td><strong>Module</strong></td>
       -          <td class="class-name-in-header">Kvlr::ReportsAsSparkline::ClassMethods</td>
       +          <td class="class-name-in-header">Simplabs::ReportsAsSparkline::ClassMethods</td>
                </tr>
                <tr class="top-aligned-row">
                    <td><strong>In:</strong></td>
                    <td>
       -                <a href="../../../files/lib/kvlr/reports_as_sparkline_rb.html">
       -                lib/kvlr/reports_as_sparkline.rb
       +                <a href="../../../files/lib/simplabs/reports_as_sparkline_rb.html">
       +                lib/simplabs/reports_as_sparkline.rb
                        </a>
                <br />
                    </td>
       @@ -115,7 +115,7 @@
                  <p>
        Generates a report on a model. That report can then be executed via the new
        method &lt;name&gt;_report (see documentation of <a
       -href="Report.html#M000011">Kvlr::ReportsAsSparkline::Report#run</a>).
       +href="Report.html#M000011">Simplabs::ReportsAsSparkline::Report#run</a>).
        </p>
        <h4>Parameters</h4>
        <ul>
       @@ -177,14 +177,14 @@ false)
                    onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000002-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline.rb, line 39</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline.rb, line 39</span>
        39:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reports_as_sparkline</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {})
        40:         (<span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>; <span class="ruby-keyword kw">self</span>; <span class="ruby-keyword kw">end</span>).<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span>
        41:           <span class="ruby-identifier">define_method</span> <span class="ruby-node">&quot;#{name.to_s}_report&quot;</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
        42:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:cumulate</span>)
       -43:               <span class="ruby-identifier">report</span> = <span class="ruby-constant">Kvlr</span><span class="ruby-operator">::</span><span class="ruby-constant">ReportsAsSparkline</span><span class="ruby-operator">::</span><span class="ruby-constant">CumulatedReport</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>)
       +43:               <span class="ruby-identifier">report</span> = <span class="ruby-constant">Simplabs</span><span class="ruby-operator">::</span><span class="ruby-constant">ReportsAsSparkline</span><span class="ruby-operator">::</span><span class="ruby-constant">CumulatedReport</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>)
        44:             <span class="ruby-keyword kw">else</span>
       -45:               <span class="ruby-identifier">report</span> = <span class="ruby-constant">Kvlr</span><span class="ruby-operator">::</span><span class="ruby-constant">ReportsAsSparkline</span><span class="ruby-operator">::</span><span class="ruby-constant">Report</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>)
       +45:               <span class="ruby-identifier">report</span> = <span class="ruby-constant">Simplabs</span><span class="ruby-operator">::</span><span class="ruby-constant">ReportsAsSparkline</span><span class="ruby-operator">::</span><span class="ruby-constant">Report</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>)
        46:             <span class="ruby-keyword kw">end</span>
        47:             <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">args</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>))
        48:             <span class="ruby-identifier">report</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">args</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> {} <span class="ruby-operator">:</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
 (DIR) diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/CumulatedReport.html b/rdoc/classes/Kvlr/ReportsAsSparkline/CumulatedReport.html
       @@ -5,7 +5,7 @@
        
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
       -  <title>Class: Kvlr::ReportsAsSparkline::CumulatedReport</title>
       +  <title>Class: Simplabs::ReportsAsSparkline::CumulatedReport</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" media="screen" />
       @@ -50,13 +50,13 @@
                <table class="header-table">
                <tr class="top-aligned-row">
                  <td><strong>Class</strong></td>
       -          <td class="class-name-in-header">Kvlr::ReportsAsSparkline::CumulatedReport</td>
       +          <td class="class-name-in-header">Simplabs::ReportsAsSparkline::CumulatedReport</td>
                </tr>
                <tr class="top-aligned-row">
                    <td><strong>In:</strong></td>
                    <td>
       -                <a href="../../../files/lib/kvlr/reports_as_sparkline/cumulated_report_rb.html">
       -                lib/kvlr/reports_as_sparkline/cumulated_report.rb
       +                <a href="../../../files/lib/simplabs/reports_as_sparkline/cumulated_report_rb.html">
       +                lib/simplabs/reports_as_sparkline/cumulated_report.rb
                        </a>
                <br />
                    </td>
       @@ -83,15 +83,15 @@
            <div id="description">
              <p>
        A special report class that cumulates all data (see <a
       -href="Report.html">Kvlr::ReportsAsSparkline::Report</a>)
       +href="Report.html">Simplabs::ReportsAsSparkline::Report</a>)
        </p>
        <h4>Examples</h4>
        <pre>
       - When Kvlr::ReportsAsSparkline::Report returns
       + When Simplabs::ReportsAsSparkline::Report returns
        
           [[&lt;DateTime today&gt;, 1], [&lt;DateTime yesterday&gt;, 2], etc.]
        
       - Kvlr::ReportsAsSparkline::CumulatedReport returns
       + Simplabs::ReportsAsSparkline::CumulatedReport returns
        
           [[&lt;DateTime today&gt;, 3], [&lt;DateTime yesterday&gt;, 2], etc.]
        </pre>
       @@ -139,13 +139,13 @@ href="Report.html">Kvlr::ReportsAsSparkline::Report</a>)
                <div class="method-description">
                  <p>
        Runs the report (see <a
       -href="Report.html#M000011">Kvlr::ReportsAsSparkline::Report#run</a>)
       +href="Report.html#M000011">Simplabs::ReportsAsSparkline::Report#run</a>)
        </p>
                  <p><a class="source-toggle" href="#"
                    onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000003-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/cumulated_report.rb, line 19</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/cumulated_report.rb, line 19</span>
        19:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">options</span> = {})
        20:         <span class="ruby-identifier">cumulate</span>(<span class="ruby-keyword kw">super</span>)
        21:       <span class="ruby-keyword kw">end</span>
 (DIR) diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/Grouping.html b/rdoc/classes/Kvlr/ReportsAsSparkline/Grouping.html
       @@ -5,7 +5,7 @@
        
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
       -  <title>Class: Kvlr::ReportsAsSparkline::Grouping</title>
       +  <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" media="screen" />
       @@ -50,13 +50,13 @@
                <table class="header-table">
                <tr class="top-aligned-row">
                  <td><strong>Class</strong></td>
       -          <td class="class-name-in-header">Kvlr::ReportsAsSparkline::Grouping</td>
       +          <td class="class-name-in-header">Simplabs::ReportsAsSparkline::Grouping</td>
                </tr>
                <tr class="top-aligned-row">
                    <td><strong>In:</strong></td>
                    <td>
       -                <a href="../../../files/lib/kvlr/reports_as_sparkline/grouping_rb.html">
       -                lib/kvlr/reports_as_sparkline/grouping.rb
       +                <a href="../../../files/lib/simplabs/reports_as_sparkline/grouping_rb.html">
       +                lib/simplabs/reports_as_sparkline/grouping.rb
                        </a>
                <br />
                    </td>
       @@ -137,7 +137,7 @@ href="Grouping.html#M000005">identifier</a> of the grouping - one of :hour,
                    onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000004-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/grouping.rb, line 10</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/grouping.rb, line 10</span>
        10:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">identifier</span>)
        11:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Invalid grouping #{identifier}&quot;</span>) <span class="ruby-keyword kw">unless</span> [<span class="ruby-identifier">:hour</span>, <span class="ruby-identifier">:day</span>, <span class="ruby-identifier">:week</span>, <span class="ruby-identifier">:month</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">identifier</span>)
        12:         <span class="ruby-ivar">@identifier</span> = <span class="ruby-identifier">identifier</span>
       @@ -167,7 +167,7 @@ href="Grouping.html#M000005">identifier</a>
                    onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000005-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/grouping.rb, line 16</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/grouping.rb, line 16</span>
        16:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">identifier</span>
        17:         <span class="ruby-ivar">@identifier</span>
        18:       <span class="ruby-keyword kw">end</span>
 (DIR) diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/Report.html b/rdoc/classes/Kvlr/ReportsAsSparkline/Report.html
       @@ -5,7 +5,7 @@
        
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
       -  <title>Class: Kvlr::ReportsAsSparkline::Report</title>
       +  <title>Class: Simplabs::ReportsAsSparkline::Report</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" media="screen" />
       @@ -50,13 +50,13 @@
                <table class="header-table">
                <tr class="top-aligned-row">
                  <td><strong>Class</strong></td>
       -          <td class="class-name-in-header">Kvlr::ReportsAsSparkline::Report</td>
       +          <td class="class-name-in-header">Simplabs::ReportsAsSparkline::Report</td>
                </tr>
                <tr class="top-aligned-row">
                    <td><strong>In:</strong></td>
                    <td>
       -                <a href="../../../files/lib/kvlr/reports_as_sparkline/report_rb.html">
       -                lib/kvlr/reports_as_sparkline/report.rb
       +                <a href="../../../files/lib/simplabs/reports_as_sparkline/report_rb.html">
       +                lib/simplabs/reports_as_sparkline/report.rb
                        </a>
                <br />
                    </td>
       @@ -168,12 +168,12 @@ and calculations
        <ul>
        <li><tt>klass</tt> - The model the report works on (This is the class you
        invoke <a
       -href="ClassMethods.html#M000002">Kvlr::ReportsAsSparkline::ClassMethods#reports_as_sparkline</a>
       +href="ClassMethods.html#M000002">Simplabs::ReportsAsSparkline::ClassMethods#reports_as_sparkline</a>
        on)
        
        </li>
        <li><tt>name</tt> - The name of the report (as in <a
       -href="ClassMethods.html#M000002">Kvlr::ReportsAsSparkline::ClassMethods#reports_as_sparkline</a>)
       +href="ClassMethods.html#M000002">Simplabs::ReportsAsSparkline::ClassMethods#reports_as_sparkline</a>)
        
        </li>
        </ul>
       @@ -216,7 +216,7 @@ false)
                    onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000010-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report.rb, line 23</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/report.rb, line 23</span>
        23:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {})
        24:         <span class="ruby-identifier">ensure_valid_options</span>(<span class="ruby-identifier">options</span>)
        25:         <span class="ruby-ivar">@klass</span>        = <span class="ruby-identifier">klass</span>
       @@ -279,7 +279,7 @@ false)
                    onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000011-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/report.rb, line 47</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/report.rb, line 47</span>
        47:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">options</span> = {})
        48:         <span class="ruby-identifier">ensure_valid_options</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">:run</span>)
        49:         <span class="ruby-identifier">custom_conditions</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">:conditions</span>)
 (DIR) diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html b/rdoc/classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html
       @@ -5,7 +5,7 @@
        
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
       -  <title>Class: Kvlr::ReportsAsSparkline::ReportingPeriod</title>
       +  <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" media="screen" />
       @@ -50,13 +50,13 @@
                <table class="header-table">
                <tr class="top-aligned-row">
                  <td><strong>Class</strong></td>
       -          <td class="class-name-in-header">Kvlr::ReportsAsSparkline::ReportingPeriod</td>
       +          <td class="class-name-in-header">Simplabs::ReportsAsSparkline::ReportingPeriod</td>
                </tr>
                <tr class="top-aligned-row">
                    <td><strong>In:</strong></td>
                    <td>
       -                <a href="../../../files/lib/kvlr/reports_as_sparkline/reporting_period_rb.html">
       -                lib/kvlr/reports_as_sparkline/reporting_period.rb
       +                <a href="../../../files/lib/simplabs/reports_as_sparkline/reporting_period_rb.html">
       +                lib/simplabs/reports_as_sparkline/reporting_period.rb
                        </a>
                <br />
                    </td>
       @@ -158,7 +158,7 @@ href="Grouping.html">Grouping</a> :day and limit 2 would be Time.now -
        <h4>Parameters</h4>
        <ul>
        <li><tt>grouping</tt> - The <a
       -href="Grouping.html">Kvlr::ReportsAsSparkline::Grouping</a> of the
       +href="Grouping.html">Simplabs::ReportsAsSparkline::Grouping</a> of the
        reporting period
        
        </li>
       @@ -171,7 +171,7 @@ href="ReportingPeriod.html#M000007">first</a> one
                    onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000007-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/reporting_period.rb, line 23</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/reporting_period.rb, line 23</span>
        23:       <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">grouping</span>, <span class="ruby-identifier">limit</span>)
        24:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">grouping</span>.<span class="ruby-identifier">identifier</span>
        25:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:hour</span>
       @@ -203,7 +203,7 @@ href="ReportingPeriod.html#M000007">first</a> one
                  <h4>Parameters</h4>
        <ul>
        <li><tt>grouping</tt> - The <a
       -href="Grouping.html">Kvlr::ReportsAsSparkline::Grouping</a> of the
       +href="Grouping.html">Simplabs::ReportsAsSparkline::Grouping</a> of the
        reporting period
        
        </li>
       @@ -215,7 +215,7 @@ reporting period
                    onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000006-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/reporting_period.rb, line 13</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/reporting_period.rb, line 13</span>
        13:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">grouping</span>, <span class="ruby-identifier">date_time</span> = <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">now</span>)
        14:         <span class="ruby-ivar">@grouping</span>  = <span class="ruby-identifier">grouping</span>
        15:         <span class="ruby-ivar">@date_time</span> = <span class="ruby-identifier">parse_date_time</span>(<span class="ruby-identifier">date_time</span>)
       @@ -246,7 +246,7 @@ hour/day/month/year)
                    onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000008-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/reporting_period.rb, line 53</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/reporting_period.rb, line 53</span>
        53:       <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">next</span>
        54:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@grouping</span>.<span class="ruby-identifier">identifier</span>
        55:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:hour</span>
       @@ -283,7 +283,7 @@ hour/day/month/year)
                    onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000009-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/reporting_period.rb, line 67</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/reporting_period.rb, line 67</span>
        67:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">previous</span>
        68:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@grouping</span>.<span class="ruby-identifier">identifier</span>
        69:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:hour</span>
 (DIR) diff --git a/rdoc/classes/Kvlr/ReportsAsSparkline/SparklineTagHelper.html b/rdoc/classes/Kvlr/ReportsAsSparkline/SparklineTagHelper.html
       @@ -5,7 +5,7 @@
        
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
       -  <title>Module: Kvlr::ReportsAsSparkline::SparklineTagHelper</title>
       +  <title>Module: Simplabs::ReportsAsSparkline::SparklineTagHelper</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" media="screen" />
       @@ -50,13 +50,13 @@
                <table class="header-table">
                <tr class="top-aligned-row">
                  <td><strong>Module</strong></td>
       -          <td class="class-name-in-header">Kvlr::ReportsAsSparkline::SparklineTagHelper</td>
       +          <td class="class-name-in-header">Simplabs::ReportsAsSparkline::SparklineTagHelper</td>
                </tr>
                <tr class="top-aligned-row">
                    <td><strong>In:</strong></td>
                    <td>
       -                <a href="../../../files/lib/kvlr/reports_as_sparkline/sparkline_tag_helper_rb.html">
       -                lib/kvlr/reports_as_sparkline/sparkline_tag_helper.rb
       +                <a href="../../../files/lib/simplabs/reports_as_sparkline/sparkline_tag_helper_rb.html">
       +                lib/simplabs/reports_as_sparkline/sparkline_tag_helper.rb
                        </a>
                <br />
                    </td>
       @@ -151,7 +151,7 @@ href="SparklineTagHelper.html#M000001">sparkline_tag</a>(User.registrations_repo
                    onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
                  <div class="method-source-code" id="M000001-source">
        <pre>
       -    <span class="ruby-comment cmt"># File lib/kvlr/reports_as_sparkline/sparkline_tag_helper.rb, line 23</span>
       +    <span class="ruby-comment cmt"># File lib/simplabs/reports_as_sparkline/sparkline_tag_helper.rb, line 23</span>
        23:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sparkline_tag</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">options</span> = {})
        24:         <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>({ <span class="ruby-identifier">:width</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">300</span>, <span class="ruby-identifier">:height</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">34</span>, <span class="ruby-identifier">:line_color</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'0077cc'</span>, <span class="ruby-identifier">:fill_color</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'e6f2fa'</span>, <span class="ruby-identifier">:labels</span> =<span class="ruby-operator">&gt;</span> [] })
        25:         <span class="ruby-identifier">data</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> <span class="ruby-identifier">d</span>[<span class="ruby-value">1</span>] }
 (DIR) diff --git a/rdoc/files/README_rdoc.html b/rdoc/files/README_rdoc.html
       @@ -227,7 +227,7 @@ If you are on Rails &amp;lt; 2.1, do this from your RAILS_ROOT
        <p>
        To achieve best performance, you should add indices to your tables on the
        date columns that are used for grouping the records (see
       -Kvlr::ReportsAsSparkline::ClassMethods.reports_as_sparkline):
       +Simplabs::ReportsAsSparkline::ClassMethods.reports_as_sparkline):
        </p>
        <pre>
          add_index :[table], :[date_column]
 (DIR) diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/cumulated_report_rb.html b/rdoc/files/lib/kvlr/reports_as_sparkline/cumulated_report_rb.html
       @@ -51,7 +51,7 @@
            <table class="header-table">
            <tr class="top-aligned-row">
              <td><strong>Path:</strong></td>
       -      <td>lib/kvlr/reports_as_sparkline/cumulated_report.rb
       +      <td>lib/simplabs/reports_as_sparkline/cumulated_report.rb
              </td>
            </tr>
            <tr class="top-aligned-row">
 (DIR) diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/grouping_rb.html b/rdoc/files/lib/kvlr/reports_as_sparkline/grouping_rb.html
       @@ -51,7 +51,7 @@
            <table class="header-table">
            <tr class="top-aligned-row">
              <td><strong>Path:</strong></td>
       -      <td>lib/kvlr/reports_as_sparkline/grouping.rb
       +      <td>lib/simplabs/reports_as_sparkline/grouping.rb
              </td>
            </tr>
            <tr class="top-aligned-row">
 (DIR) diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/report_cache_rb.html b/rdoc/files/lib/kvlr/reports_as_sparkline/report_cache_rb.html
       @@ -51,7 +51,7 @@
            <table class="header-table">
            <tr class="top-aligned-row">
              <td><strong>Path:</strong></td>
       -      <td>lib/kvlr/reports_as_sparkline/report_cache.rb
       +      <td>lib/simplabs/reports_as_sparkline/report_cache.rb
              </td>
            </tr>
            <tr class="top-aligned-row">
 (DIR) diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/report_rb.html b/rdoc/files/lib/kvlr/reports_as_sparkline/report_rb.html
       @@ -51,7 +51,7 @@
            <table class="header-table">
            <tr class="top-aligned-row">
              <td><strong>Path:</strong></td>
       -      <td>lib/kvlr/reports_as_sparkline/report.rb
       +      <td>lib/simplabs/reports_as_sparkline/report.rb
              </td>
            </tr>
            <tr class="top-aligned-row">
 (DIR) diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/reporting_period_rb.html b/rdoc/files/lib/kvlr/reports_as_sparkline/reporting_period_rb.html
       @@ -51,7 +51,7 @@
            <table class="header-table">
            <tr class="top-aligned-row">
              <td><strong>Path:</strong></td>
       -      <td>lib/kvlr/reports_as_sparkline/reporting_period.rb
       +      <td>lib/simplabs/reports_as_sparkline/reporting_period.rb
              </td>
            </tr>
            <tr class="top-aligned-row">
 (DIR) diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline/sparkline_tag_helper_rb.html b/rdoc/files/lib/kvlr/reports_as_sparkline/sparkline_tag_helper_rb.html
       @@ -51,7 +51,7 @@
            <table class="header-table">
            <tr class="top-aligned-row">
              <td><strong>Path:</strong></td>
       -      <td>lib/kvlr/reports_as_sparkline/sparkline_tag_helper.rb
       +      <td>lib/simplabs/reports_as_sparkline/sparkline_tag_helper.rb
              </td>
            </tr>
            <tr class="top-aligned-row">
 (DIR) diff --git a/rdoc/files/lib/kvlr/reports_as_sparkline_rb.html b/rdoc/files/lib/kvlr/reports_as_sparkline_rb.html
       @@ -51,7 +51,7 @@
            <table class="header-table">
            <tr class="top-aligned-row">
              <td><strong>Path:</strong></td>
       -      <td>lib/kvlr/reports_as_sparkline.rb
       +      <td>lib/simplabs/reports_as_sparkline.rb
              </td>
            </tr>
            <tr class="top-aligned-row">
 (DIR) diff --git a/rdoc/fr_class_index.html b/rdoc/fr_class_index.html
       @@ -20,12 +20,12 @@
        <div id="index">
          <h1 class="section-bar">Classes</h1>
          <div id="index-entries">
       -    <a href="classes/Kvlr/ReportsAsSparkline/ClassMethods.html">Kvlr::ReportsAsSparkline::ClassMethods</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/CumulatedReport.html">Kvlr::ReportsAsSparkline::CumulatedReport</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html">Kvlr::ReportsAsSparkline::Grouping</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/Report.html">Kvlr::ReportsAsSparkline::Report</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html">Kvlr::ReportsAsSparkline::ReportingPeriod</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/SparklineTagHelper.html">Kvlr::ReportsAsSparkline::SparklineTagHelper</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/ClassMethods.html">Simplabs::ReportsAsSparkline::ClassMethods</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/CumulatedReport.html">Simplabs::ReportsAsSparkline::CumulatedReport</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/Grouping.html">Simplabs::ReportsAsSparkline::Grouping</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/Report.html">Simplabs::ReportsAsSparkline::Report</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html">Simplabs::ReportsAsSparkline::ReportingPeriod</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/SparklineTagHelper.html">Simplabs::ReportsAsSparkline::SparklineTagHelper</a><br />
          </div>
        </div>
        </body>
 (DIR) diff --git a/rdoc/fr_file_index.html b/rdoc/fr_file_index.html
       @@ -21,13 +21,13 @@
          <h1 class="section-bar">Files</h1>
          <div id="index-entries">
            <a href="files/README_rdoc.html">README.rdoc</a><br />
       -    <a href="files/lib/kvlr/reports_as_sparkline_rb.html">lib/kvlr/reports_as_sparkline.rb</a><br />
       -    <a href="files/lib/kvlr/reports_as_sparkline/cumulated_report_rb.html">lib/kvlr/reports_as_sparkline/cumulated_report.rb</a><br />
       -    <a href="files/lib/kvlr/reports_as_sparkline/grouping_rb.html">lib/kvlr/reports_as_sparkline/grouping.rb</a><br />
       -    <a href="files/lib/kvlr/reports_as_sparkline/report_rb.html">lib/kvlr/reports_as_sparkline/report.rb</a><br />
       -    <a href="files/lib/kvlr/reports_as_sparkline/report_cache_rb.html">lib/kvlr/reports_as_sparkline/report_cache.rb</a><br />
       -    <a href="files/lib/kvlr/reports_as_sparkline/reporting_period_rb.html">lib/kvlr/reports_as_sparkline/reporting_period.rb</a><br />
       -    <a href="files/lib/kvlr/reports_as_sparkline/sparkline_tag_helper_rb.html">lib/kvlr/reports_as_sparkline/sparkline_tag_helper.rb</a><br />
       +    <a href="files/lib/simplabs/reports_as_sparkline_rb.html">lib/simplabs/reports_as_sparkline.rb</a><br />
       +    <a href="files/lib/simplabs/reports_as_sparkline/cumulated_report_rb.html">lib/simplabs/reports_as_sparkline/cumulated_report.rb</a><br />
       +    <a href="files/lib/simplabs/reports_as_sparkline/grouping_rb.html">lib/simplabs/reports_as_sparkline/grouping.rb</a><br />
       +    <a href="files/lib/simplabs/reports_as_sparkline/report_rb.html">lib/simplabs/reports_as_sparkline/report.rb</a><br />
       +    <a href="files/lib/simplabs/reports_as_sparkline/report_cache_rb.html">lib/simplabs/reports_as_sparkline/report_cache.rb</a><br />
       +    <a href="files/lib/simplabs/reports_as_sparkline/reporting_period_rb.html">lib/simplabs/reports_as_sparkline/reporting_period.rb</a><br />
       +    <a href="files/lib/simplabs/reports_as_sparkline/sparkline_tag_helper_rb.html">lib/simplabs/reports_as_sparkline/sparkline_tag_helper.rb</a><br />
          </div>
        </div>
        </body>
 (DIR) diff --git a/rdoc/fr_method_index.html b/rdoc/fr_method_index.html
       @@ -20,17 +20,17 @@
        <div id="index">
          <h1 class="section-bar">Methods</h1>
          <div id="index-entries">
       -    <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000007">first (Kvlr::ReportsAsSparkline::ReportingPeriod)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html#M000005">identifier (Kvlr::ReportsAsSparkline::Grouping)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000006">new (Kvlr::ReportsAsSparkline::ReportingPeriod)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/Grouping.html#M000004">new (Kvlr::ReportsAsSparkline::Grouping)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/Report.html#M000010">new (Kvlr::ReportsAsSparkline::Report)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000008">next (Kvlr::ReportsAsSparkline::ReportingPeriod)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/ReportingPeriod.html#M000009">previous (Kvlr::ReportsAsSparkline::ReportingPeriod)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/ClassMethods.html#M000002">reports_as_sparkline (Kvlr::ReportsAsSparkline::ClassMethods)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/CumulatedReport.html#M000003">run (Kvlr::ReportsAsSparkline::CumulatedReport)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/Report.html#M000011">run (Kvlr::ReportsAsSparkline::Report)</a><br />
       -    <a href="classes/Kvlr/ReportsAsSparkline/SparklineTagHelper.html#M000001">sparkline_tag (Kvlr::ReportsAsSparkline::SparklineTagHelper)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000007">first (Simplabs::ReportsAsSparkline::ReportingPeriod)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/Grouping.html#M000005">identifier (Simplabs::ReportsAsSparkline::Grouping)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000006">new (Simplabs::ReportsAsSparkline::ReportingPeriod)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/Grouping.html#M000004">new (Simplabs::ReportsAsSparkline::Grouping)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/Report.html#M000010">new (Simplabs::ReportsAsSparkline::Report)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000008">next (Simplabs::ReportsAsSparkline::ReportingPeriod)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/ReportingPeriod.html#M000009">previous (Simplabs::ReportsAsSparkline::ReportingPeriod)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/ClassMethods.html#M000002">reports_as_sparkline (Simplabs::ReportsAsSparkline::ClassMethods)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/CumulatedReport.html#M000003">run (Simplabs::ReportsAsSparkline::CumulatedReport)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/Report.html#M000011">run (Simplabs::ReportsAsSparkline::Report)</a><br />
       +    <a href="classes/Simplabs/ReportsAsSparkline/SparklineTagHelper.html#M000001">sparkline_tag (Simplabs::ReportsAsSparkline::SparklineTagHelper)</a><br />
          </div>
        </div>
        </body>
 (DIR) diff --git a/spec/classes/cumulated_report_spec.rb b/spec/classes/cumulated_report_spec.rb
       @@ -1,9 +1,9 @@
        require File.join(File.dirname(__FILE__), '..', 'spec_helper')
        
       -describe Kvlr::ReportsAsSparkline::CumulatedReport do
       +describe Simplabs::ReportsAsSparkline::CumulatedReport do
        
          before do
       -    @report = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations)
       +    @report = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations)
          end
        
          describe '#run' do
       @@ -15,13 +15,13 @@ describe Kvlr::ReportsAsSparkline::CumulatedReport do
            end
        
            it 'should return an array of the same length as the specified limit when :live_data is false' do
       -      @report = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations, :limit => 10, :live_data => false)
       +      @report = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations, :limit => 10, :live_data => false)
        
              @report.run.length.should == 10
            end
        
            it 'should return an array of the same length as the specified limit + 1 when :live_data is true' do
       -      @report = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations, :limit => 10, :live_data => true)
       +      @report = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations, :limit => 10, :live_data => true)
        
              @report.run.length.should == 11
            end
       @@ -35,7 +35,7 @@ describe Kvlr::ReportsAsSparkline::CumulatedReport do
                User.create!(:login => 'test 4', :created_at => Time.now - 3.month, :profile_visits => 3)
                User.create!(:login => 'test 5', :created_at => Time.now - 4.month, :profile_visits => 4)
                
       -        @report2 = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations,
       +        @report2 = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations,
                  :grouping => :month,
                  :limit => 2
                )
       @@ -76,11 +76,11 @@ describe Kvlr::ReportsAsSparkline::CumulatedReport do
                      User.create!(:login => 'test 3', :created_at => Time.now - 3.send(grouping), :profile_visits => 3)
                    end
        
       -            describe do
       +            describe 'the returned result' do
        
                      before do
       -                @grouping = Kvlr::ReportsAsSparkline::Grouping.new(grouping)
       -                @report = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations,
       +                @grouping = Simplabs::ReportsAsSparkline::Grouping.new(grouping)
       +                @report = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :cumulated_registrations,
                          :grouping  => grouping,
                          :limit     => 10,
                          :live_data => live_data
       @@ -88,24 +88,24 @@ describe Kvlr::ReportsAsSparkline::CumulatedReport do
                        @result = @report.run
                      end
        
       -              it "should return an array starting reporting period (Time.now - limit.#{grouping.to_s})" do
       -                @result.first[0].should == Kvlr::ReportsAsSparkline::ReportingPeriod.new(@grouping, Time.now - 10.send(grouping)).date_time
       +              it "should be an array starting reporting period (Time.now - limit.#{grouping.to_s})" do
       +                @result.first[0].should == Simplabs::ReportsAsSparkline::ReportingPeriod.new(@grouping, Time.now - 10.send(grouping)).date_time
                      end
        
                      if live_data
       -                it "should return data ending with the current reporting period" do
       -                  @result.last[0].should == Kvlr::ReportsAsSparkline::ReportingPeriod.new(@grouping).date_time
       +                it "should be data ending with the current reporting period" do
       +                  @result.last[0].should == Simplabs::ReportsAsSparkline::ReportingPeriod.new(@grouping).date_time
                        end
                      else
       -                it "should return data ending with the reporting period before the current" do
       -                  @result.last[0].should == Kvlr::ReportsAsSparkline::ReportingPeriod.new(@grouping).previous.date_time
       +                it "should be data ending with the reporting period before the current" do
       +                  @result.last[0].should == Simplabs::ReportsAsSparkline::ReportingPeriod.new(@grouping).previous.date_time
                        end
                      end
        
                    end
        
                    it 'should return correct data for aggregation :count' do
       -              @report = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :registrations,
                        :aggregation => :count,
                        :grouping    => grouping,
                        :limit       => 10,
       @@ -121,7 +121,7 @@ describe Kvlr::ReportsAsSparkline::CumulatedReport do
                    end
        
                    it 'should return correct data for aggregation :sum' do
       -              @report = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :registrations,
                        :aggregation  => :sum,
                        :grouping     => grouping,
                        :value_column => :profile_visits,
       @@ -138,7 +138,7 @@ describe Kvlr::ReportsAsSparkline::CumulatedReport do
                    end
        
                    it 'should return correct data for aggregation :count when custom conditions are specified' do
       -              @report = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :registrations,
                        :aggregation => :count,
                        :grouping    => grouping,
                        :limit       => 10,
       @@ -154,7 +154,7 @@ describe Kvlr::ReportsAsSparkline::CumulatedReport do
                    end
        
                    it 'should return correct data for aggregation :sum when custom conditions are specified' do
       -              @report = Kvlr::ReportsAsSparkline::CumulatedReport.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::CumulatedReport.new(User, :registrations,
                        :aggregation  => :sum,
                        :grouping     => grouping,
                        :value_column => :profile_visits,
       @@ -183,7 +183,7 @@ describe Kvlr::ReportsAsSparkline::CumulatedReport do
            end
        
            after(:each) do
       -      Kvlr::ReportsAsSparkline::ReportCache.destroy_all
       +      Simplabs::ReportsAsSparkline::ReportCache.destroy_all
            end
        
          end
 (DIR) diff --git a/spec/classes/grouping_spec.rb b/spec/classes/grouping_spec.rb
       @@ -1,11 +1,11 @@
        require File.join(File.dirname(__FILE__), '..', 'spec_helper')
        
       -describe Kvlr::ReportsAsSparkline::Grouping do
       +describe Simplabs::ReportsAsSparkline::Grouping do
        
          describe '#new' do
        
            it 'should raise an error if an unsupported grouping is specified' do
       -      lambda { Kvlr::ReportsAsSparkline::Grouping.new(:unsupported) }.should raise_error(ArgumentError)
       +      lambda { Simplabs::ReportsAsSparkline::Grouping.new(:unsupported) }.should raise_error(ArgumentError)
            end
        
          end
       @@ -19,19 +19,19 @@ describe Kvlr::ReportsAsSparkline::Grouping do
              end
        
              it 'should use DATE_FORMAT with format string "%Y/%m/%d/%H" for grouping :hour' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:hour).send(:to_sql, 'created_at').should == "DATE_FORMAT(created_at, '%Y/%m/%d/%H')"
       +        Simplabs::ReportsAsSparkline::Grouping.new(:hour).send(:to_sql, 'created_at').should == "DATE_FORMAT(created_at, '%Y/%m/%d/%H')"
              end
        
              it 'should use DATE_FORMAT with format string "%Y/%m/%d" for grouping :day' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:day).send(:to_sql, 'created_at').should == "DATE_FORMAT(created_at, '%Y/%m/%d')"
       +        Simplabs::ReportsAsSparkline::Grouping.new(:day).send(:to_sql, 'created_at').should == "DATE_FORMAT(created_at, '%Y/%m/%d')"
              end
        
              it 'should use YEARWEEK with mode 3 for grouping :week' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:week).send(:to_sql, 'created_at').should == "YEARWEEK(created_at, 3)"
       +        Simplabs::ReportsAsSparkline::Grouping.new(:week).send(:to_sql, 'created_at').should == "YEARWEEK(created_at, 3)"
              end
        
              it 'should use DATE_FORMAT with format string "%Y/%m" for grouping :month' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:month).send(:to_sql, 'created_at').should == "DATE_FORMAT(created_at, '%Y/%m')"
       +        Simplabs::ReportsAsSparkline::Grouping.new(:month).send(:to_sql, 'created_at').should == "DATE_FORMAT(created_at, '%Y/%m')"
              end
        
            end
       @@ -45,7 +45,7 @@ describe Kvlr::ReportsAsSparkline::Grouping do
              for grouping in [:hour, :day, :week, :month] do
        
                it "should use date_trunc with truncation identifier \"#{grouping.to_s}\" for grouping :#{grouping.to_s}" do
       -          Kvlr::ReportsAsSparkline::Grouping.new(grouping).send(:to_sql, 'created_at').should == "date_trunc('#{grouping.to_s}', created_at)"
       +          Simplabs::ReportsAsSparkline::Grouping.new(grouping).send(:to_sql, 'created_at').should == "date_trunc('#{grouping.to_s}', created_at)"
                end
        
              end
       @@ -59,19 +59,19 @@ describe Kvlr::ReportsAsSparkline::Grouping do
              end
        
              it 'should use strftime with format string "%Y/%m/%d/%H" for grouping :hour' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:hour).send(:to_sql, 'created_at').should == "strftime('%Y/%m/%d/%H', created_at)"
       +        Simplabs::ReportsAsSparkline::Grouping.new(:hour).send(:to_sql, 'created_at').should == "strftime('%Y/%m/%d/%H', created_at)"
              end
        
              it 'should use strftime with format string "%Y/%m/%d" for grouping :day' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:day).send(:to_sql, 'created_at').should == "strftime('%Y/%m/%d', created_at)"
       +        Simplabs::ReportsAsSparkline::Grouping.new(:day).send(:to_sql, 'created_at').should == "strftime('%Y/%m/%d', created_at)"
              end
        
              it 'should use date with mode "weekday 0" for grouping :week' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:week).send(:to_sql, 'created_at').should == "date(created_at, 'weekday 0')"
       +        Simplabs::ReportsAsSparkline::Grouping.new(:week).send(:to_sql, 'created_at').should == "date(created_at, 'weekday 0')"
              end
        
              it 'should use strftime with format string "%Y/%m" for grouping :month' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:month).send(:to_sql, 'created_at').should == "strftime('%Y/%m', created_at)"
       +        Simplabs::ReportsAsSparkline::Grouping.new(:month).send(:to_sql, 'created_at').should == "strftime('%Y/%m', created_at)"
              end
        
            end
       @@ -89,7 +89,7 @@ describe Kvlr::ReportsAsSparkline::Grouping do
              for grouping in [[:hour, '2008/12/31/12'], [:day, '2008/12/31'], [:month, '2008/12']] do
        
                it "should split the string with '/' for grouping :#{grouping[0].to_s}" do
       -          Kvlr::ReportsAsSparkline::Grouping.new(grouping[0]).date_parts_from_db_string(grouping[1]).should == grouping[1].split('/').map(&:to_i)
       +          Simplabs::ReportsAsSparkline::Grouping.new(grouping[0]).date_parts_from_db_string(grouping[1]).should == grouping[1].split('/').map(&:to_i)
                end
        
              end
       @@ -98,7 +98,7 @@ describe Kvlr::ReportsAsSparkline::Grouping do
                db_string = '2008-2-1'
                expected = [2008, 5]
        
       -        Kvlr::ReportsAsSparkline::Grouping.new(:week).date_parts_from_db_string(db_string).should == expected
       +        Simplabs::ReportsAsSparkline::Grouping.new(:week).date_parts_from_db_string(db_string).should == expected
              end
        
            end
       @@ -110,19 +110,19 @@ describe Kvlr::ReportsAsSparkline::Grouping do
              end
        
              it 'should split the date part of the string with "-" and read out the hour for grouping :hour' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:hour).date_parts_from_db_string('2008-12-03 06:00:00').should == [2008, 12, 03, 6]
       +        Simplabs::ReportsAsSparkline::Grouping.new(:hour).date_parts_from_db_string('2008-12-03 06:00:00').should == [2008, 12, 03, 6]
              end
        
              it 'should split the date part of the string with "-" for grouping :day' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:day).date_parts_from_db_string('2008-12-03 00:00:00').should == [2008, 12, 03]
       +        Simplabs::ReportsAsSparkline::Grouping.new(:day).date_parts_from_db_string('2008-12-03 00:00:00').should == [2008, 12, 03]
              end
        
              it 'should split the date part of the string with "-" and calculate the calendar week for grouping :week' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:week).date_parts_from_db_string('2008-12-01 00:00:00').should == [2008, 49]
       +        Simplabs::ReportsAsSparkline::Grouping.new(:week).date_parts_from_db_string('2008-12-01 00:00:00').should == [2008, 49]
              end
        
              it 'should split the date part of the string with "-" and return year and month for grouping :month' do
       -        Kvlr::ReportsAsSparkline::Grouping.new(:month).date_parts_from_db_string('2008-12-01 00:00:00').should == [2008, 12]
       +        Simplabs::ReportsAsSparkline::Grouping.new(:month).date_parts_from_db_string('2008-12-01 00:00:00').should == [2008, 12]
              end
        
            end
       @@ -136,7 +136,7 @@ describe Kvlr::ReportsAsSparkline::Grouping do
              for grouping in [[:hour, '2008/12/31/12'], [:day, '2008/12/31'], [:month, '2008/12']] do
        
                it "should split the string with '/' for grouping :#{grouping[0].to_s}" do
       -          Kvlr::ReportsAsSparkline::Grouping.new(grouping[0]).date_parts_from_db_string(grouping[1]).should == grouping[1].split('/').map(&:to_i)
       +          Simplabs::ReportsAsSparkline::Grouping.new(grouping[0]).date_parts_from_db_string(grouping[1]).should == grouping[1].split('/').map(&:to_i)
                end
        
              end
       @@ -145,7 +145,7 @@ describe Kvlr::ReportsAsSparkline::Grouping do
                db_string = '200852'
                expected = [2008, 52]
        
       -        Kvlr::ReportsAsSparkline::Grouping.new(:week).date_parts_from_db_string(db_string).should == expected
       +        Simplabs::ReportsAsSparkline::Grouping.new(:week).date_parts_from_db_string(db_string).should == expected
              end
        
            end
 (DIR) diff --git a/spec/classes/report_cache_spec.rb b/spec/classes/report_cache_spec.rb
       @@ -1,28 +1,28 @@
        require File.join(File.dirname(__FILE__), '..', 'spec_helper')
        
       -describe Kvlr::ReportsAsSparkline::ReportCache do
       +describe Simplabs::ReportsAsSparkline::ReportCache do
        
          before do
       -    @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations, :limit => 10)
       +    @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations, :limit => 10)
          end
        
          describe '.process' do
        
            before do
       -      Kvlr::ReportsAsSparkline::ReportCache.stub!(:find).and_return([])
       -      Kvlr::ReportsAsSparkline::ReportCache.stub!(:prepare_result).and_return([])
       +      Simplabs::ReportsAsSparkline::ReportCache.stub!(:find).and_return([])
       +      Simplabs::ReportsAsSparkline::ReportCache.stub!(:prepare_result).and_return([])
            end
        
            it 'should raise an ArgumentError if no block is given' do
              lambda do
       -        Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options)
       +        Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options)
              end.should raise_error(ArgumentError)
            end
        
            it 'sould start a transaction' do
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:transaction)
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:transaction)
        
       -      Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options) {}
       +      Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options) {}
            end
        
            describe 'with :live_data = true' do
       @@ -33,22 +33,22 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
        
              it 'should yield to the given block' do
                lambda {
       -          Kvlr::ReportsAsSparkline::ReportCache.process(@report, @options) { raise YieldMatchException.new }
       +          Simplabs::ReportsAsSparkline::ReportCache.process(@report, @options) { raise YieldMatchException.new }
                }.should raise_error(YieldMatchException)
              end
        
              it 'should yield the reporting period after the last one in the cache, and before the first one in the cache if data was read from cache' do
       -        reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(
       +        reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(
                  @report.options[:grouping],
                  Time.now - 3.send(@report.options[:grouping].identifier)
                )
       -        cached = Kvlr::ReportsAsSparkline::ReportCache.new
       +        cached = Simplabs::ReportsAsSparkline::ReportCache.new
                cached.stub!(:reporting_period).and_return(reporting_period.date_time)
       -        Kvlr::ReportsAsSparkline::ReportCache.stub!(:find).and_return([cached])
       +        Simplabs::ReportsAsSparkline::ReportCache.stub!(:find).and_return([cached])
        
                expected_dates = [[reporting_period.next.date_time, nil], [reporting_period.offset(-7).date_time, reporting_period.date_time]]
                yield_count = 0
       -        Kvlr::ReportsAsSparkline::ReportCache.process(@report, @options) do |begin_at, end_at|
       +        Simplabs::ReportsAsSparkline::ReportCache.process(@report, @options) do |begin_at, end_at|
                  [begin_at, end_at].should == expected_dates[yield_count]
                  yield_count += 1
                  []
       @@ -62,32 +62,32 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
            describe 'with :live_data = false' do
        
              it 'should not yield to the block if data for the reporting period before the current one has been found in the cache' do
       -        cached = Kvlr::ReportsAsSparkline::ReportCache.new
       -        cached.stub!(:reporting_period).and_return(Kvlr::ReportsAsSparkline::ReportingPeriod.new(@report.options[:grouping]).previous)
       -        Kvlr::ReportsAsSparkline::ReportCache.stub!(:find).and_return([cached])
       +        cached = Simplabs::ReportsAsSparkline::ReportCache.new
       +        cached.stub!(:reporting_period).and_return(Simplabs::ReportsAsSparkline::ReportingPeriod.new(@report.options[:grouping]).previous)
       +        Simplabs::ReportsAsSparkline::ReportCache.stub!(:find).and_return([cached])
                lambda {
       -          Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options) { raise YieldMatchException.new }
       +          Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options) { raise YieldMatchException.new }
                }.should_not raise_error(YieldMatchException)
              end
        
              it 'should yield to the block if no data for the reporting period before the current one has been found in the cache' do
                lambda {
       -          Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options) { raise YieldMatchException.new }
       +          Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options) { raise YieldMatchException.new }
                }.should raise_error(YieldMatchException)
              end
        
              it 'should yield the reporting period after the last one in the cache, and before the first one in the cache if data was read from cache' do
       -        reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(
       +        reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(
                  @report.options[:grouping],
                  Time.now - 3.send(@report.options[:grouping].identifier)
                )
       -        cached = Kvlr::ReportsAsSparkline::ReportCache.new
       +        cached = Simplabs::ReportsAsSparkline::ReportCache.new
                cached.stub!(:reporting_period).and_return(reporting_period.date_time)
       -        Kvlr::ReportsAsSparkline::ReportCache.stub!(:find).and_return([cached])
       +        Simplabs::ReportsAsSparkline::ReportCache.stub!(:find).and_return([cached])
        
                expected_dates = [[reporting_period.next.date_time, nil], [reporting_period.offset(-7).date_time, reporting_period.date_time]]
                yield_count = 0
       -        Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options) do |begin_at, end_at|
       +        Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options) do |begin_at, end_at|
                  [begin_at, end_at].should == expected_dates[yield_count]
                  yield_count += 1
                  []
       @@ -99,7 +99,7 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
            end
        
            it 'should read existing data from the cache' do
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:find).once.with(
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:find).once.with(
                :all,
                :conditions => [
                  'model_name = ? AND report_name = ? AND grouping = ? AND aggregation = ? AND reporting_period >= ?',
       @@ -107,18 +107,18 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
                  @report.name.to_s,
                  @report.options[:grouping].identifier.to_s,
                  @report.aggregation.to_s,
       -          Kvlr::ReportsAsSparkline::ReportingPeriod.first(@report.options[:grouping], 10).date_time
       +          Simplabs::ReportsAsSparkline::ReportingPeriod.first(@report.options[:grouping], 10).date_time
                ],
                :limit => 10,
                :order => 'reporting_period ASC'
              )
        
       -      Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options) { [] }
       +      Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options) { [] }
            end
        
            it 'should utilize the end_date in the conditions' do
              end_date = Time.now
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:find).once.with(
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:find).once.with(
                :all,
                :conditions => [
                  'model_name = ? AND report_name = ? AND grouping = ? AND aggregation = ? AND reporting_period BETWEEN ? AND ?',
       @@ -126,19 +126,19 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
                  @report.name.to_s,
                  @report.options[:grouping].identifier.to_s,
                  @report.aggregation.to_s,
       -          Kvlr::ReportsAsSparkline::ReportingPeriod.first(@report.options[:grouping], 10).date_time,
       -          Kvlr::ReportsAsSparkline::ReportingPeriod.new(@report.options[:grouping], end_date).date_time
       +          Simplabs::ReportsAsSparkline::ReportingPeriod.first(@report.options[:grouping], 10).date_time,
       +          Simplabs::ReportsAsSparkline::ReportingPeriod.new(@report.options[:grouping], end_date).date_time
                ],
                :limit => 10,
                :order => 'reporting_period ASC'
              )
        
       -      Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options.merge(:end_date => end_date)) { [] }
       +      Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options.merge(:end_date => end_date)) { [] }
            end
        
            it "should read existing data from the cache for the correct grouping if one other than the report's default grouping is specified" do
       -      grouping = Kvlr::ReportsAsSparkline::Grouping.new(:month)
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:find).once.with(
       +      grouping = Simplabs::ReportsAsSparkline::Grouping.new(:month)
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:find).once.with(
                :all,
                :conditions => [
                  'model_name = ? AND report_name = ? AND grouping = ? AND aggregation = ? AND reporting_period >= ?',
       @@ -146,28 +146,28 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
                  @report.name.to_s,
                  grouping.identifier.to_s,
                  @report.aggregation.to_s,
       -          Kvlr::ReportsAsSparkline::ReportingPeriod.first(grouping, 10).date_time
       +          Simplabs::ReportsAsSparkline::ReportingPeriod.first(grouping, 10).date_time
                ],
                :limit => 10,
                :order => 'reporting_period ASC'
              )
        
       -      Kvlr::ReportsAsSparkline::ReportCache.process(@report, { :limit => 10, :grouping => grouping }) { [] }
       +      Simplabs::ReportsAsSparkline::ReportCache.process(@report, { :limit => 10, :grouping => grouping }) { [] }
            end
        
            it 'should prepare the results before it returns them' do
              new_after_cache_data = []
              new_before_cache_data = []
              cached_data = []
       -      Kvlr::ReportsAsSparkline::ReportCache.stub!(:find).and_return(cached_data)
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:prepare_result).once.with(new_before_cache_data, new_after_cache_data, cached_data, @report, @report.options, true)
       +      Simplabs::ReportsAsSparkline::ReportCache.stub!(:find).and_return(cached_data)
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:prepare_result).once.with(new_before_cache_data, new_after_cache_data, cached_data, @report, @report.options, true)
        
       -      Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options) { new_after_cache_data }
       +      Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options) { new_after_cache_data }
            end
        
            it 'should yield the first reporting period if the cache is empty' do
       -      Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options) do |begin_at, end_at|
       -        begin_at.should == Kvlr::ReportsAsSparkline::ReportingPeriod.first(@report.options[:grouping], 10).date_time
       +      Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options) do |begin_at, end_at|
       +        begin_at.should == Simplabs::ReportsAsSparkline::ReportingPeriod.first(@report.options[:grouping], 10).date_time
                end_at.should == nil
                []
              end
       @@ -176,14 +176,14 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
            describe 'with cache = false' do
        
              it 'should not read any data from cache' do
       -        Kvlr::ReportsAsSparkline::ReportCache.should_not_receive(:find)
       +        Simplabs::ReportsAsSparkline::ReportCache.should_not_receive(:find)
        
       -        Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options, false) {}
       +        Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options, false) {}
              end
        
              it 'should yield the first reporting period' do
       -        Kvlr::ReportsAsSparkline::ReportCache.process(@report, @report.options, false) do |begin_at, end_at|
       -          begin_at.should == Kvlr::ReportsAsSparkline::ReportingPeriod.first(@report.options[:grouping], 10).date_time
       +        Simplabs::ReportsAsSparkline::ReportCache.process(@report, @report.options, false) do |begin_at, end_at|
       +          begin_at.should == Simplabs::ReportsAsSparkline::ReportingPeriod.first(@report.options[:grouping], 10).date_time
                  end_at.should == nil
                  []
                end
       @@ -196,56 +196,56 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
          describe '.prepare_result' do
        
            before do
       -      @current_reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(@report.options[:grouping])
       +      @current_reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(@report.options[:grouping])
              @new_after_cache_data = [[@current_reporting_period.previous.date_time, 1.0]]
       -      Kvlr::ReportsAsSparkline::ReportingPeriod.stub!(:from_db_string).and_return(@current_reporting_period.previous)
       -      @cached = Kvlr::ReportsAsSparkline::ReportCache.new
       +      Simplabs::ReportsAsSparkline::ReportingPeriod.stub!(:from_db_string).and_return(@current_reporting_period.previous)
       +      @cached = Simplabs::ReportsAsSparkline::ReportCache.new
              @cached.stub!(:save!)
       -      Kvlr::ReportsAsSparkline::ReportCache.stub!(:build_cached_data).and_return(@cached)
       +      Simplabs::ReportsAsSparkline::ReportCache.stub!(:build_cached_data).and_return(@cached)
            end
        
            it 'should convert the date strings from the newly read data to reporting periods' do
       -      Kvlr::ReportsAsSparkline::ReportingPeriod.should_receive(:from_db_string).once.with(@report.options[:grouping], @new_after_cache_data[0][0]).and_return(Kvlr::ReportsAsSparkline::ReportingPeriod.new(@report.options[:grouping]))
       +      Simplabs::ReportsAsSparkline::ReportingPeriod.should_receive(:from_db_string).once.with(@report.options[:grouping], @new_after_cache_data[0][0]).and_return(Simplabs::ReportsAsSparkline::ReportingPeriod.new(@report.options[:grouping]))
        
       -      Kvlr::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options)
       +      Simplabs::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options)
            end
        
       -    it 'should create :limit instances of Kvlr::ReportsAsSparkline::ReportCache with value 0.0 if no new data has been read and nothing was cached' do
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:build_cached_data).exactly(10).times.with(
       +    it 'should create :limit instances of Simplabs::ReportsAsSparkline::ReportCache with value 0.0 if no new data has been read and nothing was cached' do
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:build_cached_data).exactly(10).times.with(
                @report,
                @report.options[:grouping],
                anything(),
                0.0
              ).and_return(@cached)
        
       -      Kvlr::ReportsAsSparkline::ReportCache.send(:prepare_result, [], [], [], @report, @report.options)
       +      Simplabs::ReportsAsSparkline::ReportCache.send(:prepare_result, [], [], [], @report, @report.options)
            end
        
       -    it 'should create a new Kvlr::ReportsAsSparkline::ReportCache with the correct value if new data has been read' do
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:build_cached_data).exactly(9).times.with(
       +    it 'should create a new Simplabs::ReportsAsSparkline::ReportCache with the correct value if new data has been read' do
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:build_cached_data).exactly(9).times.with(
                @report,
                @report.options[:grouping],
                anything(),
                0.0
              ).and_return(@cached)
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:build_cached_data).once.with(
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:build_cached_data).once.with(
                @report,
                @report.options[:grouping],
                @current_reporting_period.previous,
                1.0
              ).and_return(@cached)
        
       -      Kvlr::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options)
       +      Simplabs::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options)
            end
        
       -    it 'should save the created Kvlr::ReportsAsSparkline::ReportCache' do
       +    it 'should save the created Simplabs::ReportsAsSparkline::ReportCache' do
              @cached.should_receive(:save!).once
        
       -      Kvlr::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options)
       +      Simplabs::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options)
            end
        
            it 'should return an array of arrays of Dates and Floats' do
       -      result = Kvlr::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options, true)
       +      result = Simplabs::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options, true)
        
              result.should be_kind_of(Array)
              result[0].should be_kind_of(Array)
       @@ -256,7 +256,7 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
            describe 'with :live_data = false' do
        
              before do
       -        @result = Kvlr::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options, true)
       +        @result = Simplabs::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options, true)
              end
        
              it 'should return an array of length :limit' do
       @@ -273,7 +273,7 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
        
              before do
                options = @report.options.merge(:live_data => true)
       -        @result = Kvlr::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, options, true)
       +        @result = Simplabs::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, options, true)
              end
        
              it 'should return an array of length (:limit + 1)' do
       @@ -288,10 +288,10 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
        
            describe 'with cache = false' do
        
       -      it 'should not save the created Kvlr::ReportsAsSparkline::ReportCache' do
       +      it 'should not save the created Simplabs::ReportsAsSparkline::ReportCache' do
                @cached.should_not_receive(:save!)
        
       -        Kvlr::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options, false)
       +        Simplabs::ReportsAsSparkline::ReportCache.send(:prepare_result, [], @new_after_cache_data, [], @report, @report.options, false)
              end
        
            end
       @@ -301,15 +301,15 @@ describe Kvlr::ReportsAsSparkline::ReportCache do
          describe '.find_value' do
        
            before do
       -      @data = [[Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:day)), 3.0]]
       +      @data = [[Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:day)), 3.0]]
            end
        
            it 'should return the correct value when new data has been read for the reporting period' do
       -      Kvlr::ReportsAsSparkline::ReportCache.send(:find_value, @data, @data[0][0]).should == 3.0
       +      Simplabs::ReportsAsSparkline::ReportCache.send(:find_value, @data, @data[0][0]).should == 3.0
            end
        
            it 'should return 0.0 when no data has been read for the reporting period' do
       -      Kvlr::ReportsAsSparkline::ReportCache.send(:find_value, @data, @data[0][0].next).should == 0.0
       +      Simplabs::ReportsAsSparkline::ReportCache.send(:find_value, @data, @data[0][0].next).should == 0.0
            end
        
          end
 (DIR) diff --git a/spec/classes/report_spec.rb b/spec/classes/report_spec.rb
       @@ -1,11 +1,11 @@
        require File.join(File.dirname(__FILE__), '..', 'spec_helper')
        
       -describe Kvlr::ReportsAsSparkline::Report do
       +describe Simplabs::ReportsAsSparkline::Report do
        
          before do
            @now = DateTime.now
            DateTime.stub!(:now).and_return(@now)
       -    @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations)
       +    @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations)
          end
        
          describe '#options' do
       @@ -19,9 +19,9 @@ describe Kvlr::ReportsAsSparkline::Report do
          describe '#run' do
        
            it 'should process the data with the report cache' do
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
                @report,
       -        { :limit => 100, :grouping => @report.options[:grouping], :conditions => [], :live_data => false, :end_date => nil },
       +        { :limit => 100, :grouping => @report.options[:grouping], :conditions => [], :live_data => false, :end_date => false },
                true
              )
        
       @@ -29,9 +29,9 @@ describe Kvlr::ReportsAsSparkline::Report do
            end
        
            it 'should process the data with the report cache and specify cache = false when custom conditions are given' do
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
                @report,
       -        { :limit => 100, :grouping => @report.options[:grouping], :conditions => { :some => :condition }, :live_data => false, :end_date => nil },
       +        { :limit => 100, :grouping => @report.options[:grouping], :conditions => { :some => :condition }, :live_data => false, :end_date => false },
                false
              )
        
       @@ -45,11 +45,11 @@ describe Kvlr::ReportsAsSparkline::Report do
            end
        
            it 'should use a custom grouping if one is specified' do
       -      grouping = Kvlr::ReportsAsSparkline::Grouping.new(:month)
       -      Kvlr::ReportsAsSparkline::Grouping.should_receive(:new).once.with(:month).and_return(grouping)
       -      Kvlr::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
       +      grouping = Simplabs::ReportsAsSparkline::Grouping.new(:month)
       +      Simplabs::ReportsAsSparkline::Grouping.should_receive(:new).once.with(:month).and_return(grouping)
       +      Simplabs::ReportsAsSparkline::ReportCache.should_receive(:process).once.with(
                @report,
       -        { :limit => 100, :grouping => grouping, :conditions => [], :live_data => false, :end_date => nil },
       +        { :limit => 100, :grouping => grouping, :conditions => [], :live_data => false, :end_date => false },
                true
              )
        
       @@ -57,13 +57,13 @@ describe Kvlr::ReportsAsSparkline::Report do
            end
        
            it 'should return an array of the same length as the specified limit when :live_data is false' do
       -      @report = Kvlr::ReportsAsSparkline::Report.new(User, :cumulated_registrations, :limit => 10, :live_data => false)
       +      @report = Simplabs::ReportsAsSparkline::Report.new(User, :cumulated_registrations, :limit => 10, :live_data => false)
        
              @report.run.length.should == 10
            end
        
            it 'should return an array of the same length as the specified limit + 1 when :live_data is true' do
       -      @report = Kvlr::ReportsAsSparkline::Report.new(User, :cumulated_registrations, :limit => 10, :live_data => true)
       +      @report = Simplabs::ReportsAsSparkline::Report.new(User, :cumulated_registrations, :limit => 10, :live_data => true)
        
              @report.run.length.should == 11
            end
       @@ -75,7 +75,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                User.create!(:login => 'test 3', :created_at => Time.now - 3.month, :profile_visits => 2)
                User.create!(:login => 'test 4', :created_at => Time.now - 3.month, :profile_visits => 3)
        
       -        @report2 = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +        @report2 = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                  :grouping => :month,
                  :limit => 2
                )
       @@ -126,11 +126,11 @@ describe Kvlr::ReportsAsSparkline::Report do
                      User.create!(:login => 'test 4', :created_at => Time.now - 3.send(grouping), :profile_visits => 3)
                    end
        
       -            describe do
       +            describe 'the returned result' do
        
                      before do
       -                @grouping = Kvlr::ReportsAsSparkline::Grouping.new(grouping)
       -                @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +                @grouping = Simplabs::ReportsAsSparkline::Grouping.new(grouping)
       +                @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                          :grouping => grouping,
                          :limit => 10,
                          :live_data => live_data
       @@ -138,24 +138,24 @@ describe Kvlr::ReportsAsSparkline::Report do
                        @result = @report.run
                      end
        
       -              it "should return an array starting reporting period (Time.now - limit.#{grouping.to_s})" do
       -                @result.first[0].should == Kvlr::ReportsAsSparkline::ReportingPeriod.new(@grouping, Time.now - 10.send(grouping)).date_time
       +              it "should be an array starting reporting period (Time.now - limit.#{grouping.to_s})" do
       +                @result.first[0].should == Simplabs::ReportsAsSparkline::ReportingPeriod.new(@grouping, Time.now - 10.send(grouping)).date_time
                      end
        
                      if live_data
       -                it "should return data ending with the current reporting period" do
       -                  @result.last[0].should == Kvlr::ReportsAsSparkline::ReportingPeriod.new(@grouping).date_time
       +                it "should be data ending with the current reporting period" do
       +                  @result.last[0].should == Simplabs::ReportsAsSparkline::ReportingPeriod.new(@grouping).date_time
                        end
                      else
       -                it "should return data ending with the reporting period before the current" do
       -                  @result.last[0].should == Kvlr::ReportsAsSparkline::ReportingPeriod.new(@grouping).previous.date_time
       +                it "should be data ending with the reporting period before the current" do
       +                  @result.last[0].should == Simplabs::ReportsAsSparkline::ReportingPeriod.new(@grouping).previous.date_time
                        end
                      end
        
                    end
        
                    it 'should return correct data for aggregation :count' do
       -              @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                        :aggregation => :count,
                        :grouping    => grouping,
                        :limit       => 10,
       @@ -171,7 +171,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                    end
        
                    it 'should return correct data for aggregation :sum' do
       -              @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                        :aggregation  => :sum,
                        :grouping     => grouping,
                        :value_column => :profile_visits,
       @@ -188,7 +188,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                    end
        
                    it 'should return correct data for aggregation :maximum' do
       -              @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                        :aggregation  => :maximum,
                        :grouping     => grouping,
                        :value_column => :profile_visits,
       @@ -205,7 +205,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                    end
        
                    it 'should return correct data for aggregation :minimum' do
       -              @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                        :aggregation  => :minimum,
                        :grouping     => grouping,
                        :value_column => :profile_visits,
       @@ -222,7 +222,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                    end
        
                    it 'should return correct data for aggregation :average' do
       -              @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                        :aggregation  => :average,
                        :grouping     => grouping,
                        :value_column => :profile_visits,
       @@ -239,7 +239,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                    end
        
                    it 'should return correct data for aggregation :count when custom conditions are specified' do
       -              @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                        :aggregation => :count,
                        :grouping    => grouping,
                        :limit       => 10,
       @@ -255,7 +255,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                    end
        
                    it 'should return correct data for aggregation :sum when custom conditions are specified' do
       -              @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +              @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                        :aggregation  => :sum,
                        :grouping     => grouping,
                        :value_column => :profile_visits,
       @@ -298,7 +298,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                end
        
                it 'should return correct data for aggregation :count' do
       -          @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +          @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                    :aggregation => :count,
                    :grouping    => :week,
                    :limit       => 10
       @@ -327,7 +327,7 @@ describe Kvlr::ReportsAsSparkline::Report do
                end
        
                it 'should return correct data for aggregation :count' do
       -          @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations,
       +          @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations,
                    :aggregation => :count,
                    :grouping    => :week,
                    :limit       => 10
       @@ -346,7 +346,7 @@ describe Kvlr::ReportsAsSparkline::Report do
            end
        
            after do
       -      Kvlr::ReportsAsSparkline::ReportCache.destroy_all
       +      Simplabs::ReportsAsSparkline::ReportCache.destroy_all
            end
        
            after(:all) do
       @@ -358,7 +358,7 @@ describe Kvlr::ReportsAsSparkline::Report do
          describe '#read_data' do
        
            it 'should invoke the aggregation method on the model' do
       -      @report = Kvlr::ReportsAsSparkline::Report.new(User, :registrations, :aggregation => :count)
       +      @report = Simplabs::ReportsAsSparkline::Report.new(User, :registrations, :aggregation => :count)
              User.should_receive(:count).once.and_return([])
        
              @report.send(:read_data, Time.now, 5.days.from_now, { :grouping => @report.options[:grouping], :conditions => [] })
 (DIR) diff --git a/spec/classes/reporting_period_spec.rb b/spec/classes/reporting_period_spec.rb
       @@ -1,19 +1,19 @@
        require File.join(File.dirname(__FILE__), '..', 'spec_helper')
        
       -describe Kvlr::ReportsAsSparkline::ReportingPeriod do
       +describe Simplabs::ReportsAsSparkline::ReportingPeriod do
        
          describe '#date_time' do
        
            it 'should return the date and time with minutes = seconds = 0 for grouping :hour' do
              date_time = DateTime.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:hour), date_time)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:hour), date_time)
        
              reporting_period.date_time.should == DateTime.new(date_time.year, date_time.month, date_time.day, date_time.hour, 0, 0)
            end
        
            it 'should return the date part only for grouping :day' do
              date_time = DateTime.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:day), date_time)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:day), date_time)
        
              reporting_period.date_time.should == date_time.to_date
            end
       @@ -22,28 +22,28 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
              it 'should return the date of the monday of the week date_time is in for any day in that week' do
                date_time = DateTime.new(2008, 11, 27)
       -        reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:week), date_time)
       +        reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:week), date_time)
        
                reporting_period.date_time.should == Date.new(date_time.year, date_time.month, 24)
              end
        
              it 'should return the date of the monday of the week date_time is in when the specified date is a monday already' do
                date_time = DateTime.new(2008, 11, 24) #this is a monday already, should not change
       -        reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:week), date_time)
       +        reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:week), date_time)
        
                reporting_period.date_time.should == Date.new(date_time.year, date_time.month, 24) # expect to get monday 24th again
              end
        
              it 'should return the date of the monday of the week date_time is in when the monday is in a different month than the specified date' do
                date_time = DateTime.new(2008, 11, 1) #this is a saturday
       -        reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:week), date_time)
       +        reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:week), date_time)
        
                reporting_period.date_time.should == Date.new(2008, 10, 27) # expect to get the monday before the 1st, which is in october
              end
        
              it 'should return the date of the monday of the week date_time is in when the monday is in a different year than the specified date' do
                date_time = DateTime.new(2009, 1, 1) #this is a thursday
       -        reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:week), date_time)
       +        reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:week), date_time)
        
                reporting_period.date_time.should == Date.new(2008, 12, 29) # expect to get the monday before the 1st, which is in december 2008
              end
       @@ -52,7 +52,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return the date with day = 1 for grouping :month' do
              date_time = Time.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), date_time)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), date_time)
        
              reporting_period.date_time.should == Date.new(date_time.year, date_time.month, 1)
            end
       @@ -62,31 +62,31 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
          describe '.from_db_string' do
        
            it 'should return a reporting period with the correct date and time and with minutes = seconds = 0 for grouping :hour' do
       -      grouping = Kvlr::ReportsAsSparkline::Grouping.new(:hour)
       +      grouping = Simplabs::ReportsAsSparkline::Grouping.new(:hour)
              grouping.stub!(:date_parts_from_db_string).and_return([2008, 1, 1, 12])
        
       -      Kvlr::ReportsAsSparkline::ReportingPeriod.from_db_string(grouping, '').date_time.should == DateTime.new(2008, 1, 1, 12, 0, 0)
       +      Simplabs::ReportsAsSparkline::ReportingPeriod.from_db_string(grouping, '').date_time.should == DateTime.new(2008, 1, 1, 12, 0, 0)
            end
        
            it 'should return a reporting period with the date part only for grouping :day' do
       -      grouping = Kvlr::ReportsAsSparkline::Grouping.new(:day)
       +      grouping = Simplabs::ReportsAsSparkline::Grouping.new(:day)
              grouping.stub!(:date_parts_from_db_string).and_return([2008, 1, 1])
        
       -      Kvlr::ReportsAsSparkline::ReportingPeriod.from_db_string(grouping, '').date_time.should == Date.new(2008, 1, 1)
       +      Simplabs::ReportsAsSparkline::ReportingPeriod.from_db_string(grouping, '').date_time.should == Date.new(2008, 1, 1)
            end
        
            it 'should return a reporting period with the date part of the monday of the week the date is in for grouping :week' do
       -      grouping = Kvlr::ReportsAsSparkline::Grouping.new(:week)
       +      grouping = Simplabs::ReportsAsSparkline::Grouping.new(:week)
              grouping.stub!(:date_parts_from_db_string).and_return([2008, 1])
        
       -      Kvlr::ReportsAsSparkline::ReportingPeriod.from_db_string(grouping, '').date_time.should == Date.new(2007, 12, 31)
       +      Simplabs::ReportsAsSparkline::ReportingPeriod.from_db_string(grouping, '').date_time.should == Date.new(2007, 12, 31)
            end
        
            it 'should return a reporting period with the correct date and with day = 1 for grouping :month' do
       -      grouping = Kvlr::ReportsAsSparkline::Grouping.new(:month)
       +      grouping = Simplabs::ReportsAsSparkline::Grouping.new(:month)
              grouping.stub!(:date_parts_from_db_string).and_return([2008, 1])
        
       -      Kvlr::ReportsAsSparkline::ReportingPeriod.from_db_string(grouping, '').date_time.should == Date.new(2008, 1, 1)
       +      Simplabs::ReportsAsSparkline::ReportingPeriod.from_db_string(grouping, '').date_time.should == Date.new(2008, 1, 1)
            end
        
          end
       @@ -95,7 +95,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with date and time one hour after the current period for grouping :hour' do
              now = Time.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:hour), now)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:hour), now)
              expected = now + 1.hour
        
              reporting_period.next.date_time.should == DateTime.new(expected.year, expected.month, expected.day, expected.hour)
       @@ -103,7 +103,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with date one day after the current period for grouping :day' do
              now = Time.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:day), now)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:day), now)
              expected = now + 1.day
        
              reporting_period.next.date_time.should == Date.new(expected.year, expected.month, expected.day)
       @@ -111,7 +111,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with date one week after the current period for grouping :week' do
              now = DateTime.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:week), now)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:week), now)
              expected = reporting_period.date_time + 1.week
        
              reporting_period.next.date_time.should == Date.new(expected.year, expected.month, expected.day)
       @@ -119,7 +119,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with date of the first day in the month one month after the current period' do
              now = Time.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), now)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), now)
              expected = reporting_period.date_time + 1.month
        
              reporting_period.next.date_time.should == Date.new(expected.year, expected.month, 1)
       @@ -131,7 +131,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with date and time one hour before the current period for grouping :hour' do
              now = Time.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:hour), now)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:hour), now)
              expected = now - 1.hour
        
              reporting_period.previous.date_time.should == DateTime.new(expected.year, expected.month, expected.day, expected.hour)
       @@ -139,7 +139,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with date one day before the current period for grouping :day' do
              now = Time.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:day), now)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:day), now)
              expected = now - 1.day
        
              reporting_period.previous.date_time.should == Date.new(expected.year, expected.month, expected.day)
       @@ -147,7 +147,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with date one week before the current period for grouping :week' do
              now = DateTime.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:week), now)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:week), now)
              expected = reporting_period.date_time - 1.week
        
              reporting_period.previous.date_time.should == Date.new(expected.year, expected.month, expected.day)
       @@ -155,7 +155,7 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with date of the first day in the month one month before the current period' do
              now = Time.now
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), now)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), now)
              expected = reporting_period.date_time - 1.month
        
              reporting_period.previous.date_time.should == Date.new(expected.year, expected.month, 1)
       @@ -167,30 +167,30 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return true for 2 reporting periods with the same date_time and grouping' do
              now = DateTime.now
       -      reporting_period1 = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), now)
       -      reporting_period2 = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), now)
       +      reporting_period1 = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), now)
       +      reporting_period2 = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), now)
        
              (reporting_period1 == reporting_period2).should == true
            end
        
            it 'should return false for 2 reporting periods with the same date_time but different groupings' do
              now = Time.now
       -      reporting_period1 = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), now)
       -      reporting_period2 = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:day), now)
       +      reporting_period1 = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), now)
       +      reporting_period2 = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:day), now)
        
              (reporting_period1 == reporting_period2).should == false
            end
        
            it 'should return true for 2 reporting periods with the same grouping but different date_times if the date times evaluate to the same reporting period identifier' do
       -      reporting_period1 = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), Time.now)
       -      reporting_period2 = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), Time.now + 1.day)
       +      reporting_period1 = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), Time.now)
       +      reporting_period2 = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), Time.now + 1.day)
        
              (reporting_period1 == reporting_period2).should == true
            end
        
            it 'should return false for 2 reporting periods with the same grouping but different date_times if the date times evaluate to different reporting period identifiers' do
       -      reporting_period1 = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), Time.now)
       -      reporting_period2 = Kvlr::ReportsAsSparkline::ReportingPeriod.new(Kvlr::ReportsAsSparkline::Grouping.new(:month), Time.now + 2.months)
       +      reporting_period1 = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), Time.now)
       +      reporting_period2 = Simplabs::ReportsAsSparkline::ReportingPeriod.new(Simplabs::ReportsAsSparkline::Grouping.new(:month), Time.now + 2.months)
        
              (reporting_period1 == reporting_period2).should == false
            end
       @@ -205,14 +205,14 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
            end
        
            it 'should return a reporting period with the date part of (DateTime.now - limit.hours with minutes = seconds = 0 for grouping :hour' do
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.first(Kvlr::ReportsAsSparkline::Grouping.new(:hour), 3)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.first(Simplabs::ReportsAsSparkline::Grouping.new(:hour), 3)
              expected = @now - 3.hours
        
              reporting_period.date_time.should == DateTime.new(expected.year, expected.month, expected.day, expected.hour, 0, 0)
            end
        
            it 'should return a reporting period with the date part of (DateTime.now - limit.days) for grouping :day' do
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.first(Kvlr::ReportsAsSparkline::Grouping.new(:day), 3)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.first(Simplabs::ReportsAsSparkline::Grouping.new(:day), 3)
              expected = @now - 3.days
        
              reporting_period.date_time.should == Date.new(expected.year, expected.month, expected.day)
       @@ -220,24 +220,18 @@ describe Kvlr::ReportsAsSparkline::ReportingPeriod do
        
            it 'should return a reporting period with the date of the first day of the month at (DateTime.now - limit.months) for grouping :month' do
              DateTime.stub!(:now).and_return(DateTime.new(2008, 12, 31, 0, 0, 0))
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.first(Kvlr::ReportsAsSparkline::Grouping.new(:month), 3)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.first(Simplabs::ReportsAsSparkline::Grouping.new(:month), 3)
        
              reporting_period.date_time.should == DateTime.new(2008, 9, 1)
            end
        
            it 'should return a reporting period with the date of the monday of the week at (DateTime.now - limit.weeks) for grouping :week' do
              DateTime.stub!(:now).and_return(DateTime.new(2008, 12, 31, 0, 0, 0)) #wednesday
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.first(Kvlr::ReportsAsSparkline::Grouping.new(:week), 3)
       +      reporting_period = Simplabs::ReportsAsSparkline::ReportingPeriod.first(Simplabs::ReportsAsSparkline::Grouping.new(:week), 3)
        
              reporting_period.date_time.should == DateTime.new(2008, 12, 8) #the monday 3 weeks earlier
            end
        
       -    it 'should return a reporting period that is offset from the end date by the limit' do
       -      date = DateTime.new(2009, 3, 31)
       -      reporting_period = Kvlr::ReportsAsSparkline::ReportingPeriod.first(Kvlr::ReportsAsSparkline::Grouping.new(:day), 3, date)
       -      reporting_period.date_time.should == DateTime.new(2009, 3, 28)
       -    end
       -
          end
        
        end
 (DIR) diff --git a/spec/other/report_method_spec.rb b/spec/other/report_method_spec.rb
       @@ -1,6 +1,6 @@
        require File.join(File.dirname(__FILE__), '..', 'spec_helper')
        
       -describe Kvlr::ReportsAsSparkline do
       +describe Simplabs::ReportsAsSparkline do
        
          describe 'for inherited models' do
        
       @@ -32,7 +32,7 @@ describe Kvlr::ReportsAsSparkline do
          end
        
          after do
       -    Kvlr::ReportsAsSparkline::ReportCache.destroy_all
       +    Simplabs::ReportsAsSparkline::ReportCache.destroy_all
          end
        
        end
 (DIR) diff --git a/spec/other/sparkline_tag_helper_spec.rb b/spec/other/sparkline_tag_helper_spec.rb
       @@ -1,6 +1,6 @@
        require File.join(File.dirname(__FILE__), '..', 'spec_helper')
        
       -describe Kvlr::ReportsAsSparkline::SparklineTagHelper do
       +describe Simplabs::ReportsAsSparkline::SparklineTagHelper do
        
          before do
            @helper = TestHelper.new
       @@ -38,6 +38,6 @@ end
        
        class TestHelper
        
       -  include Kvlr::ReportsAsSparkline::SparklineTagHelper
       +  include Simplabs::ReportsAsSparkline::SparklineTagHelper
        
        end