From 0fb187b572528c7c0a05b89c69463c42c9e87d4a Mon Sep 17 00:00:00 2001 From: Louis Charreau Date: Wed, 20 Dec 2023 14:24:11 +0100 Subject: [PATCH] Simplify with a ternary operator --- lib/puppet/provider/elastic_stack_keystore/ruby.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/puppet/provider/elastic_stack_keystore/ruby.rb b/lib/puppet/provider/elastic_stack_keystore/ruby.rb index 1480973..90a7f36 100644 --- a/lib/puppet/provider/elastic_stack_keystore/ruby.rb +++ b/lib/puppet/provider/elastic_stack_keystore/ruby.rb @@ -51,11 +51,7 @@ def self.elastic_keystore_password_file_bak end def self.elastic_keystore_password_bak - if File.file?(elastic_keystore_password_file_bak) - @elastic_keystore_password_bak ||= File.open(elastic_keystore_password_file_bak, &:readline).strip - else - @elastic_keystore_password_bak ||= '' - end + @elastic_keystore_password_bak ||= File.file?(elastic_keystore_password_file_bak) ? File.open(elastic_keystore_password_file_bak, &:readline).strip : '' end attr_accessor :defaults_dir, :root_dir, :home_dir_kibana, :home_dir_elasticsearch, :elastic_keystore_password_file, :elastic_keystore_password, :elastic_keystore_password_file_bak, :elastic_keystore_password_bak