lib/prompts/confirm_prompt.rb in prompts-0.2.0 vs lib/prompts/confirm_prompt.rb in prompts-0.2.1
- old
+ new
@@ -1,11 +1,11 @@
# frozen_string_literal: true
module Prompts
class ConfirmPrompt < Prompt
def initialize(...)
- super(...)
+ super
@prompt = if @default == false
"Choose [y/N]:"
elsif @default == true
"Choose [Y/n]:"
@@ -18,14 +18,14 @@
@validations << ->(choice) { "Invalid choice." if !["y", "n", "Y", "N", ""].include?(choice) }
end
private
- def resolve_choice_from(response)
- case response
- when "y", "Y" then true
- when "n", "N" then false
- when "" then @default_boolean
- end
+ def resolve_choice_from(response)
+ case response
+ when "y", "Y" then true
+ when "n", "N" then false
+ when "" then @default_boolean
end
+ end
end
end