ice_cube 0.16.3 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/config/locales/de.yml +1 -1
  3. data/config/locales/fr.yml +2 -2
  4. data/config/locales/id.yml +134 -0
  5. data/config/locales/it.yml +179 -0
  6. data/config/locales/nl.yml +133 -0
  7. data/config/locales/sv.yml +1 -1
  8. data/lib/ice_cube/builders/hash_builder.rb +1 -5
  9. data/lib/ice_cube/builders/ical_builder.rb +13 -15
  10. data/lib/ice_cube/builders/string_builder.rb +10 -16
  11. data/lib/ice_cube/deprecated.rb +3 -4
  12. data/lib/ice_cube/errors/count_exceeded.rb +0 -2
  13. data/lib/ice_cube/errors/until_exceeded.rb +0 -2
  14. data/lib/ice_cube/flexible_hash.rb +3 -7
  15. data/lib/ice_cube/i18n.rb +11 -23
  16. data/lib/ice_cube/input_alignment.rb +9 -11
  17. data/lib/ice_cube/null_i18n.rb +6 -6
  18. data/lib/ice_cube/occurrence.rb +10 -11
  19. data/lib/ice_cube/parsers/hash_parser.rb +3 -6
  20. data/lib/ice_cube/parsers/ical_parser.rb +39 -38
  21. data/lib/ice_cube/parsers/yaml_parser.rb +2 -4
  22. data/lib/ice_cube/rule.rb +7 -18
  23. data/lib/ice_cube/rules/daily_rule.rb +0 -4
  24. data/lib/ice_cube/rules/hourly_rule.rb +0 -4
  25. data/lib/ice_cube/rules/minutely_rule.rb +0 -4
  26. data/lib/ice_cube/rules/monthly_rule.rb +0 -4
  27. data/lib/ice_cube/rules/secondly_rule.rb +0 -4
  28. data/lib/ice_cube/rules/weekly_rule.rb +1 -5
  29. data/lib/ice_cube/rules/yearly_rule.rb +0 -4
  30. data/lib/ice_cube/schedule.rb +32 -40
  31. data/lib/ice_cube/single_occurrence_rule.rb +1 -5
  32. data/lib/ice_cube/time_util.rb +49 -57
  33. data/lib/ice_cube/validated_rule.rb +4 -10
  34. data/lib/ice_cube/validations/count.rb +2 -8
  35. data/lib/ice_cube/validations/daily_interval.rb +5 -11
  36. data/lib/ice_cube/validations/day.rb +7 -13
  37. data/lib/ice_cube/validations/day_of_month.rb +4 -10
  38. data/lib/ice_cube/validations/day_of_week.rb +10 -13
  39. data/lib/ice_cube/validations/day_of_year.rb +6 -12
  40. data/lib/ice_cube/validations/fixed_value.rb +9 -15
  41. data/lib/ice_cube/validations/hour_of_day.rb +6 -12
  42. data/lib/ice_cube/validations/hourly_interval.rb +3 -9
  43. data/lib/ice_cube/validations/lock.rb +8 -14
  44. data/lib/ice_cube/validations/minute_of_hour.rb +4 -10
  45. data/lib/ice_cube/validations/minutely_interval.rb +4 -10
  46. data/lib/ice_cube/validations/month_of_year.rb +2 -8
  47. data/lib/ice_cube/validations/monthly_interval.rb +4 -10
  48. data/lib/ice_cube/validations/schedule_lock.rb +0 -6
  49. data/lib/ice_cube/validations/second_of_minute.rb +4 -10
  50. data/lib/ice_cube/validations/secondly_interval.rb +2 -8
  51. data/lib/ice_cube/validations/until.rb +2 -8
  52. data/lib/ice_cube/validations/weekly_interval.rb +5 -11
  53. data/lib/ice_cube/validations/yearly_interval.rb +3 -9
  54. data/lib/ice_cube/version.rb +1 -3
  55. data/lib/ice_cube.rb +51 -51
  56. metadata +28 -12
  57. data/spec/spec_helper.rb +0 -79
@@ -1,13 +1,11 @@
1
- require 'delegate'
1
+ require "delegate"
2
2
 
3
3
  module IceCube
4
-
5
4
  # Find keys by symbol or string without symbolizing user input
6
5
  # Due to the serialization format of ice_cube, this limited implementation
7
6
  # is entirely sufficient
8
7
 
9
8
  class FlexibleHash < SimpleDelegator
10
-
11
9
  def [](key)
12
10
  key = _match_key(key)
13
11
  super
@@ -27,14 +25,12 @@ module IceCube
27
25
 
28
26
  def _match_key(key)
29
27
  return key if __getobj__.has_key? key
30
- if Symbol == key.class
28
+ if key.instance_of?(Symbol)
31
29
  __getobj__.keys.detect { |k| return k if k == key.to_s }
32
- elsif String == key.class
30
+ elsif key.instance_of?(String)
33
31
  __getobj__.keys.detect { |k| return k if k.to_s == key }
34
32
  end
35
33
  key
36
34
  end
37
-
38
35
  end
39
-
40
36
  end
data/lib/ice_cube/i18n.rb CHANGED
@@ -1,27 +1,15 @@
1
- require 'ice_cube/null_i18n'
1
+ require "ice_cube/null_i18n"
2
2
 
3
3
  module IceCube
4
- module I18n
5
-
6
- LOCALES_PATH = File.expand_path(File.join('..', '..', '..', 'config', 'locales'), __FILE__)
7
-
8
- def self.t(*args)
9
- backend.t(*args)
10
- end
11
-
12
- def self.l(*args)
13
- backend.l(*args)
14
- end
15
-
16
- def self.backend
17
- @backend ||= detect_backend!
18
- end
19
-
20
- def self.detect_backend!
21
- ::I18n.load_path += Dir[File.join(LOCALES_PATH, '*.yml')]
22
- ::I18n
23
- rescue NameError
24
- NullI18n
25
- end
4
+ LOCALES_PATH = File.expand_path(File.join("..", "..", "config", "locales"), __dir__)
5
+
6
+ # rubocop:disable Naming/ConstantName
7
+ I18n = begin
8
+ require "i18n"
9
+ ::I18n.load_path += Dir[File.join(LOCALES_PATH, "*.yml")]
10
+ ::I18n
11
+ rescue LoadError
12
+ NullI18n
26
13
  end
14
+ # rubocop:enable Naming/ConstantName
27
15
  end
@@ -1,6 +1,5 @@
1
1
  module IceCube
2
2
  class InputAlignment
3
-
4
3
  def initialize(rule, value, rule_part)
5
4
  @rule = rule
6
5
  @value = value
@@ -9,16 +8,16 @@ module IceCube
9
8
 
10
9
  attr_reader :rule, :value, :rule_part
11
10
 
12
- def verify(freq, options={}, &block)
11
+ def verify(freq, options = {}, &)
13
12
  @rule.validations[:interval] or return
14
13
 
15
14
  case @rule
16
15
  when DailyRule
17
- verify_wday_alignment(freq, &block)
16
+ verify_wday_alignment(freq, &)
18
17
  when MonthlyRule
19
- verify_month_alignment(freq, &block)
18
+ verify_month_alignment(freq, &)
20
19
  else
21
- verify_freq_alignment(freq, &block)
20
+ verify_freq_alignment(freq, &)
22
21
  end
23
22
  end
24
23
 
@@ -34,7 +33,7 @@ module IceCube
34
33
 
35
34
  def fixed_validations
36
35
  @fixed_validations ||= @rule.validations.values.flatten.select { |v|
37
- interval_type = (v.type == :wday ? :day : v.type)
36
+ interval_type = ((v.type == :wday) ? :day : v.type)
38
37
  v.class < Validations::FixedValue &&
39
38
  interval_type == rule.base_interval_validation.type
40
39
  }
@@ -47,13 +46,13 @@ module IceCube
47
46
  alignment = (value - last_validation.value) % interval_validation.interval
48
47
  return if alignment.zero?
49
48
 
50
- validation_values = fixed_validations.map(&:value).join(', ')
51
- if rule_part == :interval
52
- message = "interval(#{value}) " \
49
+ validation_values = fixed_validations.map(&:value).join(", ")
50
+ message = if rule_part == :interval
51
+ "interval(#{value}) " \
53
52
  "must be a multiple of " \
54
53
  "intervals in #{last_validation.key}(#{validation_values})"
55
54
  else
56
- message = "intervals in #{last_validation.key}(#{validation_values}, #{value}) " \
55
+ "intervals in #{last_validation.key}(#{validation_values}, #{value}) " \
57
56
  "must be multiples of " \
58
57
  "interval(#{interval_validation.interval})"
59
58
  end
@@ -84,6 +83,5 @@ module IceCube
84
83
 
85
84
  yield ArgumentError.new(message)
86
85
  end
87
-
88
86
  end
89
87
  end
@@ -1,11 +1,11 @@
1
- require 'yaml'
1
+ require "yaml"
2
2
 
3
3
  module IceCube
4
4
  module NullI18n
5
5
  def self.t(key, options = {})
6
- base = key.to_s.split('.').reduce(config) { |hash, current_key| hash[current_key] }
6
+ base = key.to_s.split(".").reduce(config) { |hash, current_key| hash[current_key] }
7
7
 
8
- base = base[options[:count] == 1 ? "one" : "other"] if options[:count]
8
+ base = base[(options[:count] == 1) ? "one" : "other"] if options[:count]
9
9
 
10
10
  case base
11
11
  when Hash
@@ -17,18 +17,18 @@ module IceCube
17
17
  hash[k] = v
18
18
  end
19
19
  else
20
- return base unless base.include?('%{')
20
+ return base unless base.include?("%{")
21
21
  base % options
22
22
  end
23
23
  end
24
24
 
25
25
  def self.l(date_or_time, options = {})
26
26
  return date_or_time.strftime(options[:format]) if options[:format]
27
- date_or_time.strftime(t('ice_cube.date.formats.default'))
27
+ date_or_time.strftime(t("ice_cube.date.formats.default"))
28
28
  end
29
29
 
30
30
  def self.config
31
- @config ||= YAML.load_file(File.join(IceCube::I18n::LOCALES_PATH, 'en.yml'))['en']
31
+ @config ||= YAML.load_file(File.join(IceCube::I18n::LOCALES_PATH, "en.yml"))["en"]
32
32
  end
33
33
  end
34
34
  end
@@ -1,7 +1,6 @@
1
- require 'delegate'
1
+ require "delegate"
2
2
 
3
3
  module IceCube
4
-
5
4
  # Wraps start_time and end_time in a single concept concerning the duration.
6
5
  # This delegates to the enclosed start_time so it behaves like a normal Time
7
6
  # in almost all situations, however:
@@ -23,14 +22,14 @@ module IceCube
23
22
 
24
23
  # Report class name as 'Time' to thwart type checking.
25
24
  def self.name
26
- 'Time'
25
+ "Time"
27
26
  end
28
27
 
29
28
  attr_reader :start_time, :end_time
30
- alias first start_time
31
- alias last end_time
29
+ alias_method :first, :start_time
30
+ alias_method :last, :end_time
32
31
 
33
- def initialize(start_time, end_time=nil)
32
+ def initialize(start_time, end_time = nil)
34
33
  @start_time = start_time
35
34
  @end_time = end_time || start_time
36
35
  __setobj__ @start_time
@@ -52,10 +51,10 @@ module IceCube
52
51
  def intersects?(other)
53
52
  return cover?(other) unless other.is_a?(Occurrence) || other.is_a?(Range)
54
53
 
55
- this_start = first + 1
56
- this_end = last # exclude end boundary
54
+ this_start = first + 1
55
+ this_end = last # exclude end boundary
57
56
  other_start = other.first + 1
58
- other_end = other.last + 1
57
+ other_end = other.last + 1
59
58
 
60
59
  !(this_end < other_start || this_start > other_end)
61
60
  end
@@ -85,13 +84,13 @@ module IceCube
85
84
  # Optional format argument (e.g. :long, :short) supports Rails
86
85
  # time formats and is only used when ActiveSupport is available.
87
86
  #
88
- def to_s(format=nil)
87
+ def to_s(format = nil)
89
88
  if format && to_time.public_method(:to_s).arity != 0
90
89
  t0, t1 = start_time.to_s(format), end_time.to_s(format)
91
90
  else
92
91
  t0, t1 = start_time.to_s, end_time.to_s
93
92
  end
94
- duration > 0 ? "#{t0} - #{t1}" : t0
93
+ (duration > 0) ? "#{t0} - #{t1}" : t0
95
94
  end
96
95
 
97
96
  def overnight?
@@ -1,6 +1,5 @@
1
1
  module IceCube
2
2
  class HashParser
3
-
4
3
  attr_reader :hash
5
4
 
6
5
  def initialize(original_hash)
@@ -26,13 +25,13 @@ module IceCube
26
25
  data = IceCube::FlexibleHash.new(hash.dup)
27
26
 
28
27
  if (start_date = data.delete(:start_date))
29
- warn "IceCube: :start_date is deprecated, please use :start_time at: #{ caller[0] }"
28
+ warn "IceCube: :start_date is deprecated, please use :start_time at: #{caller(1..1).first}"
30
29
  data[:start_time] = start_date
31
30
  end
32
31
 
33
- {:rdates => :rtimes, :exdates => :extimes}.each do |old_key, new_key|
32
+ {rdates: :rtimes, exdates: :extimes}.each do |old_key, new_key|
34
33
  if (times = data.delete(old_key))
35
- warn "IceCube: :#{old_key} is deprecated, please use :#{new_key} at: #{ caller[0] }"
34
+ warn "IceCube: :#{old_key} is deprecated, please use :#{new_key} at: #{caller(1..1).first}"
36
35
  (data[new_key] ||= []).concat times
37
36
  end
38
37
  end
@@ -61,7 +60,6 @@ module IceCube
61
60
 
62
61
  def apply_exrules(schedule, data)
63
62
  return unless data[:exrules]
64
- warn "IceCube: :exrules is deprecated, and will be removed in a future release. at: #{ caller[0] }"
65
63
  data[:exrules].each do |h|
66
64
  rrule = h.is_a?(IceCube::Rule) ? h : IceCube::Rule.from_hash(h)
67
65
 
@@ -86,6 +84,5 @@ module IceCube
86
84
  def parse_time(time)
87
85
  TimeUtil.deserialize_time(time)
88
86
  end
89
-
90
87
  end
91
88
  end
@@ -3,22 +3,22 @@ module IceCube
3
3
  def self.schedule_from_ical(ical_string, options = {})
4
4
  data = {}
5
5
  ical_string.each_line do |line|
6
- (property, value) = line.split(':')
7
- (property, tzid) = property.split(';')
6
+ (property, value) = line.split(":")
7
+ (property, _tzid) = property.split(";")
8
8
  case property
9
- when 'DTSTART'
9
+ when "DTSTART"
10
10
  data[:start_time] = TimeUtil.deserialize_time(value)
11
- when 'DTEND'
11
+ when "DTEND"
12
12
  data[:end_time] = TimeUtil.deserialize_time(value)
13
- when 'RDATE'
13
+ when "RDATE"
14
14
  data[:rtimes] ||= []
15
- data[:rtimes] += value.split(',').map { |v| TimeUtil.deserialize_time(v) }
16
- when 'EXDATE'
15
+ data[:rtimes] += value.split(",").map { |v| TimeUtil.deserialize_time(v) }
16
+ when "EXDATE"
17
17
  data[:extimes] ||= []
18
- data[:extimes] += value.split(',').map { |v| TimeUtil.deserialize_time(v) }
19
- when 'DURATION'
18
+ data[:extimes] += value.split(",").map { |v| TimeUtil.deserialize_time(v) }
19
+ when "DURATION"
20
20
  data[:duration] # FIXME
21
- when 'RRULE'
21
+ when "RRULE"
22
22
  data[:rrules] ||= []
23
23
  data[:rrules] += [rule_from_ical(value)]
24
24
  end
@@ -27,54 +27,55 @@ module IceCube
27
27
  end
28
28
 
29
29
  def self.rule_from_ical(ical)
30
- raise ArgumentError, 'empty ical rule' if ical.nil?
30
+ raise ArgumentError, "empty ical rule" if ical.nil?
31
31
 
32
32
  validations = {}
33
33
  params = {validations: validations, interval: 1}
34
34
 
35
- ical.split(';').each do |rule|
36
- (name, value) = rule.split('=')
35
+ ical.split(";").each do |rule|
36
+ (name, value) = rule.split("=")
37
37
  raise ArgumentError, "Invalid iCal rule component" if value.nil?
38
38
  value.strip!
39
39
  case name
40
- when 'FREQ'
41
- params[:rule_type] = "IceCube::#{value[0]}#{value.downcase[1..-1]}Rule"
42
- when 'INTERVAL'
40
+ when "FREQ"
41
+ params[:rule_type] = "IceCube::#{value[0]}#{value.downcase[1..]}Rule"
42
+ when "INTERVAL"
43
43
  params[:interval] = value.to_i
44
- when 'COUNT'
44
+ when "COUNT"
45
45
  params[:count] = value.to_i
46
- when 'UNTIL'
46
+ when "UNTIL"
47
47
  params[:until] = TimeUtil.deserialize_time(value).utc
48
- when 'WKST'
48
+ when "WKST"
49
49
  params[:week_start] = TimeUtil.ical_day_to_symbol(value)
50
- when 'BYSECOND'
51
- validations[:second_of_minute] = value.split(',').map(&:to_i)
52
- when 'BYMINUTE'
53
- validations[:minute_of_hour] = value.split(',').map(&:to_i)
54
- when 'BYHOUR'
55
- validations[:hour_of_day] = value.split(',').map(&:to_i)
56
- when 'BYDAY'
50
+ when "BYSECOND"
51
+ validations[:second_of_minute] = value.split(",").map(&:to_i)
52
+ when "BYMINUTE"
53
+ validations[:minute_of_hour] = value.split(",").map(&:to_i)
54
+ when "BYHOUR"
55
+ validations[:hour_of_day] = value.split(",").map(&:to_i)
56
+ when "BYDAY"
57
57
  dows = {}
58
58
  days = []
59
- value.split(',').each do |expr|
60
- day = TimeUtil.ical_day_to_symbol(expr.strip[-2..-1])
61
- if expr.strip.length > 2 # day with occurence
59
+ value.split(",").each do |expr|
60
+ day = TimeUtil.ical_day_to_symbol(expr.strip[-2..])
61
+ if expr.strip.length > 2 # day with occurence
62
62
  occ = expr[0..-3].to_i
63
63
  dows[day].nil? ? dows[day] = [occ] : dows[day].push(occ)
64
64
  days.delete(TimeUtil.sym_to_wday(day))
65
- else
66
- days.push TimeUtil.sym_to_wday(day) if dows[day].nil?
65
+ elsif dows[day].nil?
66
+ days.push TimeUtil.sym_to_wday(day)
67
67
  end
68
68
  end
69
69
  validations[:day_of_week] = dows unless dows.empty?
70
70
  validations[:day] = days unless days.empty?
71
- when 'BYMONTHDAY'
72
- validations[:day_of_month] = value.split(',').map(&:to_i)
73
- when 'BYMONTH'
74
- validations[:month_of_year] = value.split(',').map(&:to_i)
75
- when 'BYYEARDAY'
76
- validations[:day_of_year] = value.split(',').map(&:to_i)
77
- when 'BYSETPOS'
71
+ when "BYMONTHDAY"
72
+ validations[:day_of_month] = value.split(",").map(&:to_i)
73
+ when "BYMONTH"
74
+ validations[:month_of_year] = value.split(",").map(&:to_i)
75
+ when "BYYEARDAY"
76
+ validations[:day_of_year] = value.split(",").map(&:to_i)
77
+ when "BYSETPOS"
78
+ # noop
78
79
  else
79
80
  validations[name] = nil # invalid type
80
81
  end
@@ -1,19 +1,17 @@
1
- require 'yaml'
1
+ require "yaml"
2
2
 
3
3
  module IceCube
4
4
  class YamlParser < HashParser
5
-
6
5
  SERIALIZED_START = /start_(?:time|date): .+(?<tz>(?:-|\+)\d{2}:\d{2})$/
7
6
 
8
7
  attr_reader :hash
9
8
 
10
9
  def initialize(yaml)
11
- @hash = YAML::load(yaml)
10
+ @hash = YAML.safe_load(yaml, permitted_classes: [Date, Symbol, Time], aliases: true)
12
11
  yaml.match SERIALIZED_START do |match|
13
12
  start_time = hash[:start_time] || hash[:start_date]
14
13
  TimeUtil.restore_deserialized_offset start_time, match[:tz]
15
14
  end
16
15
  end
17
-
18
16
  end
19
17
  end
data/lib/ice_cube/rule.rb CHANGED
@@ -1,9 +1,7 @@
1
- require 'yaml'
1
+ require "yaml"
2
2
 
3
3
  module IceCube
4
-
5
4
  class Rule
6
-
7
5
  INTERVAL_TYPES = [
8
6
  :secondly, :minutely, :hourly,
9
7
  :daily, :weekly, :monthly, :yearly
@@ -39,12 +37,12 @@ module IceCube
39
37
 
40
38
  # Yaml implementation
41
39
  def to_yaml(*args)
42
- YAML::dump(to_hash, *args)
40
+ YAML.dump(to_hash, *args)
43
41
  end
44
42
 
45
43
  # From yaml
46
44
  def self.from_yaml(yaml)
47
- from_hash YAML::load(yaml)
45
+ from_hash YAML.safe_load(yaml, permitted_classes: [Date, Symbol, Time])
48
46
  end
49
47
 
50
48
  def to_hash
@@ -59,13 +57,12 @@ module IceCube
59
57
  end
60
58
 
61
59
  class << self
62
-
63
60
  # Convert from a hash and create a rule
64
61
  def from_hash(original_hash)
65
62
  hash = IceCube::FlexibleHash.new original_hash
66
63
 
67
- unless hash[:rule_type] && match = hash[:rule_type].match(/\:\:(.+?)Rule/)
68
- raise ArgumentError, 'Invalid rule type'
64
+ unless hash[:rule_type] && (match = hash[:rule_type].match(/::(.+?)Rule/))
65
+ raise ArgumentError, "Invalid rule type"
69
66
  end
70
67
 
71
68
  interval_type = match[1].downcase.to_sym
@@ -76,14 +73,11 @@ module IceCube
76
73
 
77
74
  rule = IceCube::Rule.send(interval_type, hash[:interval] || 1)
78
75
 
79
- if match[1] == "Weekly"
80
- rule.interval(hash[:interval] || 1, TimeUtil.wday_to_sym(hash[:week_start] || 0))
81
- end
82
-
76
+ rule.interval(hash[:interval] || 1, TimeUtil.wday_to_sym(hash[:week_start] || 0)) if rule.is_a? WeeklyRule
83
77
  rule.until(TimeUtil.deserialize_time(hash[:until])) if hash[:until]
84
78
  rule.count(hash[:count]) if hash[:count]
85
79
 
86
- hash[:validations] && hash[:validations].each do |name, args|
80
+ hash[:validations]&.each do |name, args|
87
81
  apply_validation(rule, name, args)
88
82
  end
89
83
 
@@ -101,12 +95,10 @@ module IceCube
101
95
 
102
96
  args.is_a?(Array) ? rule.send(name, *args) : rule.send(name, args)
103
97
  end
104
-
105
98
  end
106
99
 
107
100
  # Convenience methods for creating Rules
108
101
  class << self
109
-
110
102
  # Secondly Rule
111
103
  def secondly(interval = 1)
112
104
  SecondlyRule.new(interval)
@@ -141,9 +133,6 @@ module IceCube
141
133
  def yearly(interval = 1)
142
134
  YearlyRule.new(interval)
143
135
  end
144
-
145
136
  end
146
-
147
137
  end
148
-
149
138
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  class DailyRule < ValidatedRule
4
-
5
3
  include Validations::HourOfDay
6
4
  include Validations::MinuteOfHour
7
5
  include Validations::SecondOfMinute
@@ -19,7 +17,5 @@ module IceCube
19
17
  schedule_lock(:hour, :min, :sec)
20
18
  reset
21
19
  end
22
-
23
20
  end
24
-
25
21
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  class HourlyRule < ValidatedRule
4
-
5
3
  include Validations::HourOfDay
6
4
  include Validations::MinuteOfHour
7
5
  include Validations::SecondOfMinute
@@ -19,7 +17,5 @@ module IceCube
19
17
  schedule_lock(:min, :sec)
20
18
  reset
21
19
  end
22
-
23
20
  end
24
-
25
21
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  class MinutelyRule < ValidatedRule
4
-
5
3
  include Validations::HourOfDay
6
4
  include Validations::MinuteOfHour
7
5
  include Validations::SecondOfMinute
@@ -19,7 +17,5 @@ module IceCube
19
17
  schedule_lock(:sec)
20
18
  reset
21
19
  end
22
-
23
20
  end
24
-
25
21
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  class MonthlyRule < ValidatedRule
4
-
5
3
  include Validations::HourOfDay
6
4
  include Validations::MinuteOfHour
7
5
  include Validations::SecondOfMinute
@@ -19,7 +17,5 @@ module IceCube
19
17
  schedule_lock(:day, :hour, :min, :sec)
20
18
  reset
21
19
  end
22
-
23
20
  end
24
-
25
21
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  class SecondlyRule < ValidatedRule
4
-
5
3
  include Validations::HourOfDay
6
4
  include Validations::MinuteOfHour
7
5
  include Validations::SecondOfMinute
@@ -18,7 +16,5 @@ module IceCube
18
16
  interval(interval)
19
17
  reset
20
18
  end
21
-
22
19
  end
23
-
24
20
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  class WeeklyRule < ValidatedRule
4
-
5
3
  include Validations::HourOfDay
6
4
  include Validations::MinuteOfHour
7
5
  include Validations::SecondOfMinute
@@ -37,7 +35,7 @@ module IceCube
37
35
  time = TimeUtil::TimeWrapper.new(start_time)
38
36
  offset = wday_offset(step_time, start_time)
39
37
  time.add(:day, offset)
40
- super step_time, time.to_time
38
+ super(step_time, time.to_time)
41
39
  end
42
40
 
43
41
  # Calculate how many days to the first wday validation in the correct
@@ -57,7 +55,5 @@ module IceCube
57
55
 
58
56
  days + interval - step_wday + min_wday
59
57
  end
60
-
61
58
  end
62
-
63
59
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  class YearlyRule < ValidatedRule
4
-
5
3
  include Validations::HourOfDay
6
4
  include Validations::MinuteOfHour
7
5
  include Validations::SecondOfMinute
@@ -19,7 +17,5 @@ module IceCube
19
17
  schedule_lock(:month, :day, :hour, :min, :sec)
20
18
  reset
21
19
  end
22
-
23
20
  end
24
-
25
21
  end