Class: Nickel::RecurrenceConstruct

Inherits:
Construct
  • Object
show all
Defined in:
lib/nickel/construct.rb

Instance Attribute Summary collapse

Attributes inherited from Construct

#comp_end, #comp_start, #found_in

Instance Method Summary collapse

Methods inherited from Construct

#initialize

Constructor Details

This class inherits a constructor from Nickel::Construct

Instance Attribute Details

#repeatsObject

Returns the value of attribute repeats


39
40
41
# File 'lib/nickel/construct.rb', line 39

def repeats
  @repeats
end

#repeats_onObject

Returns the value of attribute repeats_on


39
40
41
# File 'lib/nickel/construct.rb', line 39

def repeats_on
  @repeats_on
end

Instance Method Details

#get_intervalObject


55
56
57
58
# File 'lib/nickel/construct.rb', line 55

def get_interval
  warn '[DEPRECATION] `get_interval` is deprecated.  Please use `interval` instead.'
  interval
end

#interpretObject


41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/nickel/construct.rb', line 41

def interpret
  if [:daily, :altdaily, :threedaily].include?(repeats)
    interpret_daily_variant
  elsif [:weekly, :altweekly, :threeweekly].include?(repeats)
    interpret_weekly_variant
  elsif [:daymonthly, :altdaymonthly, :threedaymonthly].include?(repeats)
    interpret_daymonthly_variant
  elsif [:datemonthly, :altdatemonthly, :threedatemonthly].include?(repeats)
    interpret_datemonthly_variant
  else
    fail StandardError, 'self is an invalid variant, check value of self.repeats'
  end
end

#intervalObject


60
61
62
63
64
65
66
67
68
69
70
# File 'lib/nickel/construct.rb', line 60

def interval
  if [:daily, :weekly, :daymonthly, :datemonthly].include?(repeats)
    1
  elsif [:altdaily, :altweekly, :altdaymonthly, :altdatemonthly].include?(repeats)
    2
  elsif [:threedaily, :threeweekly, :threedaymonthly, :threedatemonthly].include?(repeats)
    3
  else
    fail StandardError, 'self.repeats is invalid!!'
  end
end