Corrected with rubocop cop 'Lint/ShadowingOuterLocalVariable'.

This commit is contained in:
Thorsten Eckel 2015-05-08 12:33:08 +02:00
parent 409ae23e78
commit 18eaebd9b9
5 changed files with 37 additions and 39 deletions

View file

@ -202,5 +202,3 @@ Style/ClassVars:
Enabled: false
Lint/UselessAssignment:
Enabled: false
Lint/ShadowingOuterLocalVariable:
Enabled: false

View file

@ -73,9 +73,9 @@ class LongPollingController < ApplicationController
# broadcast to recipient list
if params['data']['recipient'] && params['data']['recipient']['user_id']
params['data']['recipient']['user_id'].each { |user_id|
if local_client[:user]['id'].to_s == user_id.to_s
log "send broadcast from (#{client_id}) to (user_id #{user_id})", local_client_id
params['data']['recipient']['user_id'].each { |loop_user_id|
if local_client[:user]['id'].to_s == loop_user_id.to_s
log "send broadcast from (#{client_id}) to (user_id #{loop_user_id})", local_client_id
Sessions.send( local_client_id, params['data'] )
end
}

View file

@ -320,10 +320,10 @@ returns
return cache if cache
records = where( name: data[:name] )
records.each {|record|
if record.name == data[:name]
cache_set( data[:name], record )
return record
records.each {|loop_record|
if loop_record.name == data[:name]
cache_set( data[:name], loop_record )
return loop_record
end
}
return
@ -332,10 +332,10 @@ returns
return cache if cache
records = where( login: data[:login] )
records.each {|record|
if record.login == data[:login]
cache_set( data[:login], record )
return record
records.each {|loop_record|
if loop_record.login == data[:login]
cache_set( data[:login], loop_record )
return loop_record
end
}
return
@ -362,18 +362,18 @@ returns
return record if record
elsif data[:name]
records = where( name: data[:name] )
records.each {|record|
return record if record.name == data[:name]
records.each {|loop_record|
return loop_record if loop_record.name == data[:name]
}
elsif data[:login]
records = where( login: data[:login] )
records.each {|record|
return record if record.login == data[:login]
records.each {|loop_record|
return loop_record if loop_record.login == data[:login]
}
elsif data[:locale] && data[:source]
records = where( locale: data[:locale], source: data[:source] )
records.each {|record|
return record if record.source == data[:source]
records.each {|loop_record|
return loop_record if loop_record.source == data[:source]
}
end
create(data)
@ -394,19 +394,19 @@ returns
def self.create_or_update(data)
if data[:id]
records = where( id: data[:id] )
records.each {|record|
record.update_attributes( data )
return record
records.each {|loop_record|
loop_record.update_attributes( data )
return loop_record
}
record = new( data )
record.save
return record
elsif data[:name]
records = where( name: data[:name] )
records.each {|record|
if record.name == data[:name]
record.update_attributes( data )
return record
records.each {|loop_record|
if loop_record.name == data[:name]
loop_record.update_attributes( data )
return loop_record
end
}
record = new( data )
@ -414,10 +414,10 @@ returns
return record
elsif data[:login]
records = where( login: data[:login] )
records.each {|record|
if record.login.downcase == data[:login].downcase
record.update_attributes( data )
return record
records.each {|loop_record|
if loop_record.login.downcase == data[:login].downcase
loop_record.update_attributes( data )
return loop_record
end
}
record = new( data )
@ -425,10 +425,10 @@ returns
return record
elsif data[:locale]
records = where( locale: data[:locale] )
records.each {|record|
if record.locale.downcase == data[:locale].downcase
record.update_attributes( data )
return record
records.each {|loop_record|
if loop_record.locale.downcase == data[:locale].downcase
loop_record.update_attributes( data )
return loop_record
end
}
record = new( data )

View file

@ -381,11 +381,11 @@ class Channel::EmailParser
next if !mail[item.to_sym].tree
items = mail[item.to_sym].tree
items.addresses.each {|item|
items.addresses.each {|address_data|
user_create(
firstname: item.display_name,
firstname: address_data.display_name,
lastname: '',
email: item.address,
email: address_data.address,
)
}
}

View file

@ -422,8 +422,8 @@ returns
def self.spool_create( msg )
path = "#{@path}/spool/"
FileUtils.mkpath path
file = "#{Time.zone.now.to_f}-#{rand(99_999)}"
File.open( path + '/' + file, 'wb' ) { |file|
file_path = path + "/#{Time.zone.now.to_f}-#{rand(99_999)}"
File.open( file_path, 'wb' ) { |file|
data = {
msg: msg,
timestamp: Time.zone.now.to_i,