class Ballista::Frequencies::Monthly

Monthly actions

Public Class Methods

new(*_) click to toggle source
Calls superclass method Ballista::Frequencies::Base::new
# File lib/ballista/frequencies/monthly.rb, line 6
def initialize(*_)
  super
  @when = [@when] unless @when.is_a? Array
end

Public Instance Methods

get_dates(log, pointer, counter) click to toggle source
# File lib/ballista/frequencies/monthly.rb, line 18
def get_dates(log, pointer, counter)
  date = pointer >> counter
  return log if date > @stop
  return get_dates(log, pointer, counter + 1) if date < @start
  log << entry(date)
  get_dates(log, pointer, counter + 1)
end
log() click to toggle source
# File lib/ballista/frequencies/monthly.rb, line 11
def log
  @when.flat_map do |date|
    pointer = Date.new(Date.today.year, 1, date)
    get_dates([], pointer, 0)
  end
end