class Garbanzo::Duration

Attributes

occurrences[R]
start_date[R]

Public Class Methods

new(start_date = Date.today, occurrences = 9999) click to toggle source
# File lib/garbanzo/duration.rb, line 5
def initialize(start_date = Date.today, occurrences = 9999)
  @start_date = start_date
  @occurrences = occurrences.to_i
end

Public Instance Methods

to_h() click to toggle source
# File lib/garbanzo/duration.rb, line 10
def to_h
  {
    start_date: start_date,
    occurrences: occurrences
  }
end
valid?() click to toggle source
# File lib/garbanzo/duration.rb, line 17
def valid?
  start_date.respond_to?(:strftime) && occurrences.between?(1, 9999)
end