Sha256: 786940ab8235a65d8b1b913f8316d35d0a23e43d2451520ef0e867b62c54834a

Contents?: true

Size: 1003 Bytes

Versions: 5

Compression:

Stored size: 1003 Bytes

Contents

module Montrose
  # Defines the Rule duck type for recurrence rules
  module Rule
    def self.included(base)
      base.extend ClassMethods
    end

    def include?(_time)
      fail "Class must implement #{__method__}"
    end

    def advance!(_time)
      true
    end

    def continue?
      true
    end

    module ClassMethods
      def apply_option(_opts)
        nil
      end

      def apply_options?(opts)
        apply_options(opts)
      end

      def from_options(opts)
        new(apply_options(opts)) if apply_options?(opts)
      end
    end
  end
end

require "montrose/rule/after"
require "montrose/rule/before"
require "montrose/rule/day_of_month"
require "montrose/rule/day_of_week"
require "montrose/rule/day_of_year"
require "montrose/rule/hour_of_day"
require "montrose/rule/month_of_year"
require "montrose/rule/nth_day_of_month"
require "montrose/rule/nth_day_of_year"
require "montrose/rule/time_of_day"
require "montrose/rule/total"
require "montrose/rule/week_of_year"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
montrose-0.2.2 lib/montrose/rule.rb
montrose-0.2.1 lib/montrose/rule.rb
montrose-0.2.0 lib/montrose/rule.rb
montrose-0.1.1 lib/montrose/rule.rb
montrose-0.1.0 lib/montrose/rule.rb