class Fugit::Cron::Frequency

Attributes

delta_max[R]
delta_min[R]
occurrences[R]
span[R]
span_years[R]
yearly_occurrences[R]

Public Class Methods

new(deltas, span) click to toggle source
# File lib/fugit/cron.rb, line 385
def initialize(deltas, span)

  @span = span

  @delta_min = deltas.min; @delta_max = deltas.max
  @occurrences = deltas.size
  @span_years = span / YEAR_S
  @yearly_occurrences = @occurrences.to_f / @span_years
end

Public Instance Methods

to_debug_s() click to toggle source
# File lib/fugit/cron.rb, line 395
def to_debug_s

  {
    dmin: Fugit::Duration.new(delta_min).deflate.to_plain_s,
    dmax: Fugit::Duration.new(delta_max).deflate.to_plain_s,
    ocs: occurrences,
    spn: Fugit::Duration.new(span.to_i).deflate.to_plain_s,
    spnys: span_years.to_i,
    yocs: yearly_occurrences.to_i
  }.collect { |k, v| "#{k}: #{v}" }.join(', ')
end