File: schedule_lock.rb

package info (click to toggle)
ruby-ice-cube 0.16.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 800 kB
  • sloc: ruby: 7,823; makefile: 6
file content (50 lines) | stat: -rw-r--r-- 863 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module IceCube

  module Validations::ScheduleLock

    # Lock the given time units to the units from schedule's +start_time+
    # These locks are all clobberable by other rules of the same #type
    # using +clobber_base_validation+
    #
    def schedule_lock(*types)
      types.each do |type|
        validations_for(:"base_#{type}") << Validation.new(type)
      end
    end

    class Validation < Validations::FixedValue

      attr_reader :type, :value

      def initialize(type)
        @type = type
      end

      def key
        :base
      end

      def dst_adjust?
        case @type
        when :sec, :min then false
        else true
        end
      end

      # no -op
      def build_s(builder)
      end

      # no -op
      def build_hash(builder)
      end

      # no -op
      def build_ical(builder)
      end

    end

  end

end