Class: IceCube::InputAlignment

Inherits:
Object
  • Object
show all
Defined in:
lib/ice_cube/input_alignment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule, value, rule_part) ⇒ InputAlignment

Returns a new instance of InputAlignment.



3
4
5
6
7
# File 'lib/ice_cube/input_alignment.rb', line 3

def initialize(rule, value, rule_part)
  @rule = rule
  @value = value
  @rule_part = rule_part
end

Instance Attribute Details

#ruleObject (readonly)

Returns the value of attribute rule.



9
10
11
# File 'lib/ice_cube/input_alignment.rb', line 9

def rule
  @rule
end

#rule_partObject (readonly)

Returns the value of attribute rule_part.



9
10
11
# File 'lib/ice_cube/input_alignment.rb', line 9

def rule_part
  @rule_part
end

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/ice_cube/input_alignment.rb', line 9

def value
  @value
end

Instance Method Details

#verify(freq, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ice_cube/input_alignment.rb', line 11

def verify(freq, options = {}, &)
  @rule.validations[:interval] or return

  case @rule
  when DailyRule
    verify_wday_alignment(freq, &)
  when MonthlyRule
    verify_month_alignment(freq, &)
  else
    verify_freq_alignment(freq, &)
  end
end