Method: HighLine::Question#gather
- Defined in:
- lib/highline/question.rb
#gather ⇒ Object
When set, the user will be prompted for multiple answers which will be collected into an Array or Hash and returned as the final answer.
You can set gather to an Integer to have an Array of exactly that many answers collected, or a String/Regexp to match an end input which will not be returned in the Array.
Optionally gather can be set to a Hash. In this case, the question will be asked once for each key and the answers will be returned in a Hash, mapped by key. The @key
variable is set before each question is evaluated, so you can use it in your question.
183 184 185 |
# File 'lib/highline/question.rb', line 183 def gather @gather end |