lib/origen/utility/input_capture.rb in origen-0.60.7 vs lib/origen/utility/input_capture.rb in origen-0.60.8

- old
+ new

@@ -3,18 +3,20 @@ module Utility module InputCapture # Gets text input from the user # Supply an optional default value in the event that the user enters nothing def get_text(options = {}) + # rubocop:disable Layout/MultilineHashBraceLayout options = { default: false, - single: false, # Set if only a single line entry is expected + single: false, # Set if only a single line entry is expected confirm: false, - accept: false, # Supply and array of entries you are willing to accept + accept: false, # Supply and array of entries you are willing to accept case_sensitive: false, # If accept values are supplied they will be treated as case # in-sensitive by default - wrap: true, # Automatically split long lines + wrap: true # Automatically split long lines }.merge(options) + # rubocop:enable Layout/MultilineHashBraceLayout if options[:confirm] puts "Type 'yes' or 'no' to confirm or 'quit' to abort." elsif options[:accept] puts "You can enter: #{options[:accept].map { |v| "'#{v}'" }.join(', ')} or 'quit' to abort." # " @@ -63,12 +65,10 @@ exit 0 end end if confirm == 'yes' || confirm == 'y' if options[:confirm] == :return_boolean - return true - else - return + true end else get_text(options) end