Sha256: e4c50e235f663194621c086dfca6402e420baf551442cf2ba0c10fc987c5a161

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

module YOLOBackup
  class RotationPlan
    SCHEDULE_OPTIONS = %w{ hourly daily weekly monthly yearly }

    SCHEDULE_OPTIONS.each do |option|
      attr_accessor option
    end

    attr_reader :name

    def initialize(name, options)
      @name = name
      SCHEDULE_OPTIONS.each do |option|
        send("#{option}=", options[option]) if options.key?(option)
      end
    end

    def minimum_unit
      SCHEDULE_OPTIONS.each do |option|
        return option if send(option).to_i > 0
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yolo_backup-0.0.0 lib/yolo_backup/rotation_plan.rb