From b26bdb726182b34bfad0a4d7a1d8a7058077a87e Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 7 Jul 2017 10:52:47 +0200 Subject: [PATCH] Improved code layout. --- lib/import/zendesk/user/role.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/import/zendesk/user/role.rb b/lib/import/zendesk/user/role.rb index e5b389b47..fdc960c37 100644 --- a/lib/import/zendesk/user/role.rb +++ b/lib/import/zendesk/user/role.rb @@ -43,19 +43,21 @@ module Import end def role_admin - return @role_admin if @role_admin - @role_admin = ::Role.lookup(name: 'Admin') + @role_admin ||= lookup('Admin') end def role_agent - return @role_agent if @role_agent - @role_agent = ::Role.lookup(name: 'Agent') + @role_agent ||= lookup('Agent') end def role_customer - return @role_customer if @role_customer - @role_customer = ::Role.lookup(name: 'Customer') + @role_customer ||= lookup('Customer') end + + def lookup(role_name) + ::Role.lookup(name: role_name) + end + end end end