Skip to content

Commit ba74c8b

Browse files
committed
Use a guard clause instead of wrapping the code inside a conditional expression
1 parent ed72cd6 commit ba74c8b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/t/rcfile.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ def [](username)
1717

1818
def find(username)
1919
possibilities = Array(find_case_insensitive_match(username) || find_case_insensitive_possibilities(username))
20-
if possibilities.size == 1
21-
possibilities.first
22-
else
23-
raise(ArgumentError.new("Username #{username} is #{possibilities.empty? ? 'not found.' : 'ambiguous, matching ' + possibilities.join(', ')}"))
24-
end
20+
raise(ArgumentError.new("Username #{username} is #{possibilities.empty? ? 'not found.' : 'ambiguous, matching ' + possibilities.join(', ')}")) unless possibilities.size == 1
21+
possibilities.first
2522
end
2623

2724
def find_case_insensitive_match(username)

0 commit comments

Comments
 (0)