Class: CronZoneConverter::Duplicator
- Inherits:
-
Object
- Object
- CronZoneConverter::Duplicator
- Defined in:
- lib/cron_zone_converter/duplicator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #change ⇒ Object
-
#initialize(base, changes = {}) ⇒ Duplicator
constructor
A new instance of Duplicator.
Constructor Details
#initialize(base, changes = {}) ⇒ Duplicator
Returns a new instance of Duplicator.
9 10 11 12 13 |
# File 'lib/cron_zone_converter/duplicator.rb', line 9 def initialize(base, changes = {}) @base = ::Fugit::Cron.new base @changes = changes @parts = @base.to_h end |
Class Method Details
.change(base, changes = {}) ⇒ Object
5 6 7 |
# File 'lib/cron_zone_converter/duplicator.rb', line 5 def self.change(base, changes = {}) new(base, changes).change end |
Instance Method Details
#change ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/cron_zone_converter/duplicator.rb', line 15 def change return base.dup if changes.empty? update_hours update_weekdays update_monthdays ::Fugit::Cron.new line end |