summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Metcalfe <git@patrickmetcalfe.com>2015-04-19 19:13:28 -0500
committerAndre Arko <andre@arko.net>2015-04-19 17:18:33 -0700
commitb71aeffe792529514d1dd638a91484901718596e (patch)
tree61ccf923d0bbbe8944ee39124acd55912b3c8275
parent06dc8472b9142fd6aaefff780d6d252c20dc2a04 (diff)
downloadbundler-b71aeffe792529514d1dd638a91484901718596e.tar.gz
centralized boolean question logic
-rw-r--r--lib/bundler/cli/gem.rb2
-rw-r--r--lib/bundler/ui/shell.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index e27b2a3e76..7c9f873482 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -136,7 +136,7 @@ module Bundler
if choice.nil?
Bundler.ui.confirm header
- choice = (Bundler.ui.ask("#{message} y/(n):") =~ /y|yes/)
+ choice = Bundler.ui.yes? "#{message} y/(n):"
Bundler.settings.set_global("gem.#{key}", choice)
end
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index 6299c5e9d2..81849c3a55 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -46,6 +46,14 @@ module Bundler
@shell.ask(msg)
end
+ def yes?(msg)
+ @shell.yes?(msg)
+ end
+
+ def no?
+ @shell.no?(msg)
+ end
+
def level=(level)
raise ArgumentError unless LEVELS.include?(level.to_s)
@level = level