From 0d4d9a6a63b2ac60ffeeeaef389295919c3119f4 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Wed, 31 May 2017 20:45:00 +0200 Subject: Refactor and move things around to improve in YAGNI perspective --- lib/system_check/base_executor.rb | 24 ------------------------ lib/system_check/simple_executor.rb | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 25 deletions(-) delete mode 100644 lib/system_check/base_executor.rb (limited to 'lib/system_check') diff --git a/lib/system_check/base_executor.rb b/lib/system_check/base_executor.rb deleted file mode 100644 index f76f44f3a28..00000000000 --- a/lib/system_check/base_executor.rb +++ /dev/null @@ -1,24 +0,0 @@ -module SystemCheck - # @attr_reader [Array] checks classes of corresponding checks to be executed in the same order - # @attr_reader [String] component name of the component relative to the checks being executed - class BaseExecutor - attr_reader :checks - attr_reader :component - - # @param [String] component name of the component relative to the checks being executed - def initialize(component) - raise ArgumentError unless component.is_a? String - - @component = component - @checks = Set.new - end - - # Add a check to be executed - # - # @param [BaseCheck] check class - def <<(check) - raise ArgumentError unless check < BaseCheck - @checks << check - end - end -end diff --git a/lib/system_check/simple_executor.rb b/lib/system_check/simple_executor.rb index c5403693f7a..dc2d4643a01 100644 --- a/lib/system_check/simple_executor.rb +++ b/lib/system_check/simple_executor.rb @@ -4,7 +4,29 @@ module SystemCheck # # There is no concurrency level and the output is progressively # printed into the STDOUT - class SimpleExecutor < BaseExecutor + # + # @attr_reader [Array] checks classes of corresponding checks to be executed in the same order + # @attr_reader [String] component name of the component relative to the checks being executed + class SimpleExecutor + attr_reader :checks + attr_reader :component + + # @param [String] component name of the component relative to the checks being executed + def initialize(component) + raise ArgumentError unless component.is_a? String + + @component = component + @checks = Set.new + end + + # Add a check to be executed + # + # @param [BaseCheck] check class + def <<(check) + raise ArgumentError unless check < BaseCheck + @checks << check + end + # Executes defined checks in the specified order and outputs confirmation or error information def execute start_checking(component) -- cgit v1.2.3