Method: Arcanus::UI#secret_user_input

Defined in:
lib/arcanus/ui.rb

#secret_user_inputString?

Get user input without echoing (useful for passwords).

Does not strip extraneous whitespace (since it could be part of password).

Returns:

  • (String, nil)


41
42
43
44
45
46
47
# File 'lib/arcanus/ui.rb', line 41

def secret_user_input
  if input = @input.get(noecho: true)
    input.chomp # Remove trailing newline as it is not part of password
  end
rescue Interrupt
  exit 130 # User cancelled
end