lib/eye/patch/process_set.rb in eye-patch-0.5.1 vs lib/eye/patch/process_set.rb in eye-patch-1.0.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Eye::Patch class ProcessSet < Hash def initialize(group, processes) @@ -17,21 +19,23 @@ parse_process_cluster(process) else parse_single_process( process[:name], process[:config], - process_monitors(process)) + process_monitors(process), + ) end end def parse_process_cluster(process) process[:count].times do |index| name = "#{process[:name]}-#{index}" parse_single_process( name, indexed_config(process[:config], index), - process_monitors(process)) + process_monitors(process), + ) end end def parse_single_process(name, config, monitors) self[name] = @group @@ -45,11 +49,12 @@ return unless config[:monitor_children] return unless config[:monitor_children][:checks] monitor_options = OptionSet.new( Eye::Checker, - config[:monitor_children][:checks]) + config[:monitor_children][:checks], + ) self[name][:monitor_children][:checks] = monitor_options end def indexed_config(config, index) @@ -57,10 +62,14 @@ result[key] = value.is_a?(String) ? value.gsub("{ID}", index.to_s) : value end end def process_monitors(config) - { triggers: OptionSet.new(Eye::Trigger, config[:triggers]), - checks: OptionSet.new(Eye::Checker, config[:checks]) } + { + triggers: OptionSet.new(Eye::Trigger, config[:triggers]), + checks: OptionSet.new(Eye::Checker, config[:checks]), + } end + end + end