Method: LibGems::StreamUI#ask
- Defined in:
- lib/libgems/user_interaction.rb
#ask(question) ⇒ Object
Ask a question. Returns an answer if connected to a tty, nil otherwise.
210 211 212 213 214 215 216 217 218 219 |
# File 'lib/libgems/user_interaction.rb', line 210 def ask(question) return nil if not @ins.tty? @outs.print(question + " ") @outs.flush result = @ins.gets result.chomp! if result result end |