From 329efa85665a2a8f81d2f57d6b9f630d721bcb65 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 30 Apr 2015 19:47:49 +0200 Subject: [PATCH] Corrected with rubocop cop 'Style/NonNilCheck'. --- app/models/history.rb | 2 +- app/models/user.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/history.rb b/app/models/history.rb index 5c97b1a37..42f051ee3 100644 --- a/app/models/history.rb +++ b/app/models/history.rb @@ -193,7 +193,7 @@ returns data.delete( 'value_to' ) data.delete( 'value_from' ) end - if data['related_history_object_id'] != nil + if !data['related_history_object_id'].nil? data['related_object'] = self.object_lookup_id( data['related_history_object_id'] ).name end data.delete( 'related_history_object_id' ) diff --git a/app/models/user.rb b/app/models/user.rb index 18f0eae30..743ec0a8c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -415,10 +415,10 @@ returns scan = self.firstname.scan(/, /) if scan[0] name = self.firstname.split(', ', 2) - if name[0] != nil + if !name[0].nil? self.lastname = name[0] end - if name[1] != nil + if !name[1].nil? self.firstname = name[1] end return @@ -426,10 +426,10 @@ returns # Firstname Lastname name = self.firstname.split(' ', 2) - if name[0] != nil + if !name[0].nil? self.firstname = name[0] end - if name[1] != nil + if !name[1].nil? self.lastname = name[1] end return @@ -438,10 +438,10 @@ returns elsif ( !self.firstname || self.firstname.empty? ) && ( !self.lastname || self.lastname.empty? ) && ( self.email && !self.email.empty? ) scan = self.email.scan(/^(.+?)\.(.+?)\@.+?$/) if scan[0] - if scan[0][0] != nil + if !scan[0][0].nil? self.firstname = scan[0][0].capitalize end - if scan[0][1] != nil + if !scan[0][1].nil? self.lastname = scan[0][1].capitalize end end