Sha256: b7d3d4173008ae94bd946ba6c85b1613ff4183cf46105a2b07fc3ad277c5be1f

Contents?: true

Size: 561 Bytes

Versions: 6

Compression:

Stored size: 561 Bytes

Contents

require "active_support/concern"

module Tally
  module Calculator

    extend ActiveSupport::Concern

    included do
      attr_reader :day
    end

    def initialize(day = Date.today)
      @day = day
    end

    # Override in sub class, this is what gets called when the calculator
    # is run. This method is run in the background so it can take a while
    # if needed to summarize data.
    def call
      raise NotImplementedError
    end

    private

      def record_scope
        Record.where(day: day).includes(:recordable)
      end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tally-2.1.0 lib/tally/calculator.rb
tally-2.0.0 lib/tally/calculator.rb
tally-1.0.2 lib/tally/calculator.rb
tally-1.0.1 lib/tally/calculator.rb
tally-1.0.0 lib/tally/calculator.rb
tally-1.0.0.beta1 lib/tally/calculator.rb