From 27a84a4df1a1c077e1f2d435b8fb7b3b11a9dad0 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Thu, 5 Jan 2023 12:05:11 +0900 Subject: [PATCH] Minor refactoring --- lib/youplot/parser.rb | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/youplot/parser.rb b/lib/youplot/parser.rb index aca2bbd..633ff61 100644 --- a/lib/youplot/parser.rb +++ b/lib/youplot/parser.rb @@ -30,10 +30,14 @@ module YouPlot @params = Parameters.new - if find_config_file - read_config_file - configure - end + apply_config_file + end + + def apply_config_file + return unless find_config_file + + read_config_file + configure end def config_file_candidate_paths @@ -338,12 +342,11 @@ module YouPlot else error_message = "uplot: unrecognized command '#{command}'" - if YouPlot.run_as_executable? - warn error_message - exit 1 - else - raise Error, error_message - end + raise Error, error_message unless YouPlot.run_as_executable? + + warn error_message + exit 1 + end end