instance method
Gem::StreamUI#ask
ask(question)
lib/rubygems/user_interaction.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/rubygems/user_interaction.rb, line 281
def ask(question)
return nil unless tty?
@outs.print(question + " ")
@outs.flush
result = @ins.gets
result&.chomp!
result
end
Ask a question. Returns an answer if connected to a tty, nil otherwise.
See also
#alert_warning
#ask_for_password
#alert_error
#ask_yes_no
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0