Class: YOLOBackup::RotationPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/yolo_backup/rotation_plan.rb

Constant Summary collapse

SCHEDULE_OPTIONS =
%w{ hourly daily weekly monthly yearly }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ RotationPlan

Returns a new instance of RotationPlan.



11
12
13
14
15
16
# File 'lib/yolo_backup/rotation_plan.rb', line 11

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/yolo_backup/rotation_plan.rb', line 9

def name
  @name
end

Instance Method Details

#minimum_unitObject



18
19
20
21
22
# File 'lib/yolo_backup/rotation_plan.rb', line 18

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