Class: Sentry::Cron::MonitorSchedule::Interval

Inherits:
Object
  • Object
show all
Defined in:
lib/sentry/cron/monitor_schedule.rb

Constant Summary collapse

VALID_UNITS =
%i[year month week day hour minute]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, unit) ⇒ Interval

Returns a new instance of Interval.



31
32
33
34
# File 'lib/sentry/cron/monitor_schedule.rb', line 31

def initialize(value, unit)
  @value = value
  @unit = unit
end

Instance Attribute Details

#unitSymbol

The unit representing duration of the interval.

Returns:

  • (Symbol)


27
28
29
# File 'lib/sentry/cron/monitor_schedule.rb', line 27

def unit
  @unit
end

#valueInteger

The number representing duration of the interval.

Returns:

  • (Integer)


23
24
25
# File 'lib/sentry/cron/monitor_schedule.rb', line 23

def value
  @value
end

Instance Method Details

#to_hashObject



36
37
38
# File 'lib/sentry/cron/monitor_schedule.rb', line 36

def to_hash
  { type: :interval, value: value, unit: unit }
end