lib/tty/prompt.rb
# A shortcut method to ask the user negative question and return
# true for 'no' reply.
#
# @example
#   prompt = TTY::Prompt.new
#   prompt.no?('Are you alien?') # => true
#   # => Are you human? (y/N)
#
# @return [Boolean]
#
# @api public
A shortcut method to ask the user negative question and return
true for 'no' reply.
A shortcut method to ask the user negative question and return true for ' no ' reply .
def no?(message, *args, &block)
      defaults = { default: false }
      options  = Utils.extract_options!(args)
      options.merge!(defaults.reject { |k, _| options.key?(k) })
      question = ConfirmQuestion.new(self, options)
      !question.call(message, &block)
    end
def no? ( message , * args , & block ) defaults = { default : false } 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 negative question and return
true for 'no' reply.
A shortcut method to ask the user negative question and return true for ' no ' reply .
None
Boolean
message
args
block
example
prompt = TTY::Prompt.new prompt.no?('Are you alien?') # => true # => Are you human. (y/N)
prompt = TTY :: Prompt . new prompt . no? ( ' Are you alien? ' ) # = > true # = > Are you human . ( y / N )
api
None