Skip to content

Commit 857aae6

Browse files
committed
Extract constants, rename local variables
1 parent 0824000 commit 857aae6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/gemdiff/cli.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class CLI < Thor
1212
CHECKING_FOR_OUTDATED = "Checking for outdated gems in your bundle..."
1313
NOTHING_TO_UPDATE = "Nothing to update."
1414
WORKING_DIRECTORY_IS_NOT_CLEAN = "Your working directory is not clean. Please commit or stash before updating."
15+
RESPONSES_ALL = %w[s A].freeze
16+
RESPONSES_COMPARE = %w[y A].freeze
1517

1618
desc "find <gem>", "Find the github repository URL for a gem"
1719
def find(gem_name)
@@ -64,12 +66,12 @@ def each
6466
puts CHECKING_FOR_OUTDATED
6567
inspector = BundleInspector.new
6668
puts inspector.outdated
67-
open_all = false
69+
all_action = false
6870
inspector.list.each do |outdated_gem|
6971
puts outdated_gem.compare_message
70-
response = open_all || ask("Open? (y to open, x to exit, A to open all, s to show all to stdout, else skip)")
71-
open_all = response if %w[s A].include?(response)
72-
outdated_gem.compare if %w[y A].include?(response)
72+
response = all_action || ask("Open? (y to open, x to exit, A to open all, s to show all to stdout, else skip)")
73+
all_action = response if RESPONSES_ALL.include?(response)
74+
outdated_gem.compare if RESPONSES_COMPARE.include?(response)
7375
puts outdated_gem.compare_url if response == "s"
7476
break if response == "x"
7577
end

0 commit comments

Comments
 (0)