Sha256: c48639db4a9a2d7942ae0d04d30ab7284149280a394beb298cce57761f3ba946

Contents?: true

Size: 467 Bytes

Versions: 15

Compression:

Stored size: 467 Bytes

Contents

# frozen_string_literal: true

module Montrose
  module Rule
    class Total
      include Montrose::Rule

      def self.apply_options(opts)
        opts[:total]
      end

      def initialize(max)
        @max = max
        @count = 0
      end

      def include?(time)
        continue?(time)
      end

      def advance!(time)
        @count += 1
        continue?(time)
      end

      def continue?(_time)
        @count <= @max
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
montrose-0.17.0 lib/montrose/rule/total.rb
montrose-0.16.0 lib/montrose/rule/total.rb
montrose-0.15.0 lib/montrose/rule/total.rb
montrose-0.14.0 lib/montrose/rule/total.rb
montrose-0.13.0 lib/montrose/rule/total.rb
montrose-0.12.0 lib/montrose/rule/total.rb
montrose-0.11.2 lib/montrose/rule/total.rb
montrose-0.11.1 lib/montrose/rule/total.rb
montrose-0.11.0 lib/montrose/rule/total.rb
montrose-0.10.1 lib/montrose/rule/total.rb
montrose-0.10.0 lib/montrose/rule/total.rb
montrose-0.9.0 lib/montrose/rule/total.rb
montrose-0.8.2 lib/montrose/rule/total.rb
montrose-0.8.1 lib/montrose/rule/total.rb
montrose-0.8.0 lib/montrose/rule/total.rb