lib/tty/prompt.rb
def yes?(message, *args, &block)
      defaults = { default: true }
      options  = Utils.extract_options!(args)
      options.merge!(defaults.reject { |k, _| options.key?(k) })

      question = ConfirmQuestion.new(self, options)
      question.call(message, &block)
    end
# A shortcut method to ask the user positive question and return
# true for 'yes' reply, false for 'no'.
#
# @example
#   prompt = TTY::Prompt.new
#   prompt.yes?('Are you human?')
#   # => Are you human? (Y/n)
#
# @return [Boolean]
#
# @api public
A shortcut method to ask the user positive question and return
true for 'yes' reply, false for 'no'.
A shortcut method to ask the user positive question and return true for ' yes ' reply false for ' no ' .
def yes?(message, *args, &block)
      defaults = { default: true }
      options  = Utils.extract_options!(args)
      options.merge!(defaults.reject { |k, _| options.key?(k) })
      question = ConfirmQuestion.new(self, options)
      question.call(message, &block)
    end
def yes? ( message , * args , & block ) defaults = { default : true } options = Utils . extract_options! ( args ) options . merge! ( defaults . reject { | k , _ | options . key? ( k ) } ) question = ConfirmQuestion . new ( self , options ) question . call ( message , & block ) end
A shortcut method to ask the user positive question and return
true for 'yes' reply, false for 'no'.
A shortcut method to ask the user positive question and return true for ' yes ' reply false for ' no ' .
None
Boolean
message
args
block
example
prompt = TTY::Prompt.new prompt.yes?('Are you human?') # => Are you human. (Y/n)
prompt = TTY :: Prompt . new prompt . yes? ( ' Are you human? ' ) # = > Are you human . ( Y / n )
api
None