class IceCube::Rule

Public Instance Methods

==(another_rule) click to toggle source
# File lib/recurrent/ice_cube_extensions.rb, line 4
def ==(another_rule)
  ['@interval', '@validation_types', '@validations'].all? do |variable|
    self.instance_variable_get(variable) == another_rule.instance_variable_get(variable)
  end && self.class.name == another_rule.class.name
end
frequency_in_seconds() click to toggle source
# File lib/recurrent/ice_cube_extensions.rb, line 10
def frequency_in_seconds
  rule_type = self.class
  if rule_type == IceCube::YearlyRule
    @interval.years
  elsif rule_type == IceCube::MonthlyRule
    @interval.months
  elsif rule_type == IceCube::WeeklyRule
    @interval.weeks
  elsif rule_type == IceCube::DailyRule
    @interval.days
  elsif rule_type == IceCube::HourlyRule
    @interval.hours
  elsif rule_type == IceCube::MinutelyRule
    @interval.minutes
  elsif rule_type == IceCube::SecondlyRule
    @interval.seconds
  end
end