anjlab/triggerable

View on GitHub
lib/triggerable/conditions/schedule/before.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Triggerable
  module Conditions
    class Before < ScheduleCondition
      def from
        automation_time + @value
      end

      def to
        automation_time + @value + Triggerable::Engine.interval
      end

      private

      def condition
        And.new [
          GreaterThanOrEqualTo.new(@field, from),
          LessThan.new(@field, to)
        ]
      end
    end
  end
end