Skip to content

Commit b69a9e9

Browse files
authored
Updates method documentation for ask
Adds a description for the 'default' option.
1 parent f0b510c commit b69a9e9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/thor/shell/basic.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def indent(count = 1)
4747

4848
# Asks something to the user and receives a response.
4949
#
50+
# If a default value is specified it will be presented to the user
51+
# and allows them to select that value with an empty response. This
52+
# option is ignored when limited answers are supplied.
53+
#
5054
# If asked to limit the correct responses, you can pass in an
5155
# array of acceptable answers. If one of those is not supplied,
5256
# they will be shown a message stating that one of those answers
@@ -63,6 +67,8 @@ def indent(count = 1)
6367
# ==== Example
6468
# ask("What is your name?")
6569
#
70+
# ask("What is the planet furthest from the sun?", :default => "Pluto")
71+
#
6672
# ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
6773
#
6874
# ask("What is your password?", :echo => false)

0 commit comments

Comments
 (0)