Class: Confirmator

Inherits:
Object
  • Object
show all
Defined in:
lib/busbar_cli/helpers/confirmator.rb

Class Method Summary collapse

Class Method Details

.confirm(question:, exit_message: 'Exiting without destroying the resource') ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/busbar_cli/helpers/confirmator.rb', line 3

def confirm(question:, exit_message: 'Exiting without destroying the resource')
  puts question + "\n(Y/N)"

  input = STDIN.gets.chomp

  return if input.downcase[0] == 'y'

  puts exit_message
  exit 0
end