Corrected with rubocop cop 'Style/NonNilCheck'.

This commit is contained in:
Thorsten Eckel 2015-04-30 19:47:49 +02:00
parent 4ca036ecc9
commit 329efa8566
2 changed files with 7 additions and 7 deletions

View file

@ -193,7 +193,7 @@ returns
data.delete( 'value_to' ) data.delete( 'value_to' )
data.delete( 'value_from' ) data.delete( 'value_from' )
end 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 data['related_object'] = self.object_lookup_id( data['related_history_object_id'] ).name
end end
data.delete( 'related_history_object_id' ) data.delete( 'related_history_object_id' )

View file

@ -415,10 +415,10 @@ returns
scan = self.firstname.scan(/, /) scan = self.firstname.scan(/, /)
if scan[0] if scan[0]
name = self.firstname.split(', ', 2) name = self.firstname.split(', ', 2)
if name[0] != nil if !name[0].nil?
self.lastname = name[0] self.lastname = name[0]
end end
if name[1] != nil if !name[1].nil?
self.firstname = name[1] self.firstname = name[1]
end end
return return
@ -426,10 +426,10 @@ returns
# Firstname Lastname # Firstname Lastname
name = self.firstname.split(' ', 2) name = self.firstname.split(' ', 2)
if name[0] != nil if !name[0].nil?
self.firstname = name[0] self.firstname = name[0]
end end
if name[1] != nil if !name[1].nil?
self.lastname = name[1] self.lastname = name[1]
end end
return return
@ -438,10 +438,10 @@ returns
elsif ( !self.firstname || self.firstname.empty? ) && ( !self.lastname || self.lastname.empty? ) && ( self.email && !self.email.empty? ) elsif ( !self.firstname || self.firstname.empty? ) && ( !self.lastname || self.lastname.empty? ) && ( self.email && !self.email.empty? )
scan = self.email.scan(/^(.+?)\.(.+?)\@.+?$/) scan = self.email.scan(/^(.+?)\.(.+?)\@.+?$/)
if scan[0] if scan[0]
if scan[0][0] != nil if !scan[0][0].nil?
self.firstname = scan[0][0].capitalize self.firstname = scan[0][0].capitalize
end end
if scan[0][1] != nil if !scan[0][1].nil?
self.lastname = scan[0][1].capitalize self.lastname = scan[0][1].capitalize
end end
end end