Sha256: 6fe781e6be1da992a5b0a48066d31e82a461326b6cb1527cb96eeae87923e5df

Contents?: true

Size: 488 Bytes

Versions: 2

Compression:

Stored size: 488 Bytes

Contents

require 'date'

module Ballista
  module Frequencies
    ##
    # Base class for frequency subclasses
    class Base
      def initialize(action, start, stop)
        @name = action[:name]
        @start = action[:starts] ? Date.parse(action[:starts]) : start
        @stop = action[:stops] ? Date.parse(action[:stops]) : stop
        @amount = action[:amount].to_i
        @when = action[:when]
      end

      def entry(date)
        [date, @name, @amount]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ballista-0.1.0 lib/ballista/frequencies/base.rb
ballista-0.0.5 lib/ballista/frequencies/base.rb