mirror of
https://github.com/internetee/registry.git
synced 2025-08-14 05:29:29 +02:00
Use if
modifier instead of an if
block
This commit is contained in:
parent
98f55fd48a
commit
b57adca624
1 changed files with 2 additions and 4 deletions
|
@ -36,11 +36,9 @@ module Versions
|
||||||
def user_from_id_role_username(str)
|
def user_from_id_role_username(str)
|
||||||
registrar = Registrar.find_by(name: str)
|
registrar = Registrar.find_by(name: str)
|
||||||
user = registrar.api_users.first if registrar
|
user = registrar.api_users.first if registrar
|
||||||
str_match = str.match(/^(\d+)-(ApiUser:|api-|AdminUser:)/)
|
|
||||||
|
|
||||||
if str_match
|
str_match = str.match(/^(\d+)-(ApiUser:|api-|AdminUser:)/)
|
||||||
user ||= User.find_by(id: str_match[1])
|
user ||= User.find_by(id: str_match[1]) if str_match
|
||||||
end
|
|
||||||
|
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue