summaryrefslogtreecommitdiff
path: root/lib/highline.rb
diff options
context:
space:
mode:
authorAbinoam P. Marques Jr <abinoam@gmail.com>2016-02-19 12:48:47 -0300
committerAbinoam P. Marques Jr <abinoam@gmail.com>2016-02-19 12:48:47 -0300
commit70297a61ab7be27deb15e6b25bc18358b4c679fe (patch)
treeed38a17a0fbb974a357795ee337a50fa608d0c88 /lib/highline.rb
parenta3166e918311f3caf24fba89b76179c62c3ccbd7 (diff)
parent5f0a9447c34f5fa56ede6aaf98859cf3664157f9 (diff)
downloadhighline-70297a61ab7be27deb15e6b25bc18358b4c679fe.tar.gz
Merge pull request #189 from kevinoid/fix-ask-checking
Fix agree validation to only accept "yes" or "no"
Diffstat (limited to 'lib/highline.rb')
-rwxr-xr-xlib/highline.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/highline.rb b/lib/highline.rb
index 775a4ac..70734cb 100755
--- a/lib/highline.rb
+++ b/lib/highline.rb
@@ -190,7 +190,7 @@ class HighLine
# @see Question#character
def agree( yes_or_no_question, character = nil )
ask(yes_or_no_question, lambda { |yn| yn.downcase[0] == ?y}) do |q|
- q.validate = /\Ay(?:es)?|no?\Z/i
+ q.validate = /\A(?:y(?:es)?|no?)\Z/i
q.responses[:not_valid] = 'Please enter "yes" or "no".'
q.responses[:ask_on_error] = :question
q.character = character