Sha256: 940971dd084c2fc684908a1be09e92891dd804954004645f724e86549270f222

Contents?: true

Size: 352 Bytes

Versions: 8

Compression:

Stored size: 352 Bytes

Contents

module Montrose
  class Frequency
    class Weekly < Frequency
      def include?(time)
        weeks_since_start(time) % @interval == 0
      end

      private

      def weeks_since_start(time)
        ((time.beginning_of_week - base_date) / 1.week).round
      end

      def base_date
        @starts.beginning_of_week
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
montrose-0.4.1 lib/montrose/frequency/weekly.rb
montrose-0.4.0 lib/montrose/frequency/weekly.rb
montrose-0.3.0 lib/montrose/frequency/weekly.rb
montrose-0.2.2 lib/montrose/frequency/weekly.rb
montrose-0.2.1 lib/montrose/frequency/weekly.rb
montrose-0.2.0 lib/montrose/frequency/weekly.rb
montrose-0.1.1 lib/montrose/frequency/weekly.rb
montrose-0.1.0 lib/montrose/frequency/weekly.rb