Corrected with rubocop cop 'Style/DeprecatedHashMethods'.
This commit is contained in:
parent
4b4f45ddd1
commit
44adaf000e
8 changed files with 24 additions and 24 deletions
|
@ -81,7 +81,7 @@ returns
|
|||
# only use object attributes
|
||||
data = {}
|
||||
self.new.attributes.each {|item|
|
||||
if params.has_key?(item[0])
|
||||
if params.key?(item[0])
|
||||
# puts 'use ' + item[0].to_s + '-' + params[item[0]].to_s
|
||||
data[item[0].to_sym] = params[item[0]]
|
||||
end
|
||||
|
@ -109,7 +109,7 @@ returns
|
|||
# set relations
|
||||
self.class.reflect_on_all_associations.map { |assoc|
|
||||
real_key = assoc.name.to_s[0, assoc.name.to_s.length - 1] + '_ids'
|
||||
if params.has_key?( real_key.to_sym )
|
||||
if params.key?( real_key.to_sym )
|
||||
list_of_items = params[ real_key.to_sym ]
|
||||
if params[ real_key.to_sym ].class != Array
|
||||
list_of_items = [ params[ real_key.to_sym ] ]
|
||||
|
@ -246,14 +246,14 @@ returns
|
|||
|
||||
# delete old name / login caches
|
||||
if self.changed?
|
||||
if self.changes.has_key?('name')
|
||||
if self.changes.key?('name')
|
||||
name = self.changes['name'][0].to_s
|
||||
key = self.class.to_s + '::' + name
|
||||
Cache.delete( key.to_s )
|
||||
key = self.class.to_s + ':f:' + name
|
||||
Cache.delete( key.to_s )
|
||||
end
|
||||
if self.changes.has_key?('login')
|
||||
if self.changes.key?('login')
|
||||
name = self.changes['login'][0].to_s
|
||||
key = self.class.to_s + '::' + name
|
||||
Cache.delete( key.to_s )
|
||||
|
@ -844,7 +844,7 @@ log object update history with all updated attributes, if configured - will be e
|
|||
changes = self.changes
|
||||
if self.history_changes_last_done
|
||||
self.history_changes_last_done.each {|key, value|
|
||||
if changes.has_key?(key) && changes[key] == value
|
||||
if changes.key?(key) && changes[key] == value
|
||||
changes.delete(key)
|
||||
end
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class Channel::IMAP < Channel::EmailParser
|
|||
def fetch (channel, check_type = '', verify_string = '')
|
||||
ssl = true
|
||||
port = 993
|
||||
if channel[:options].has_key?(:ssl) && channel[:options][:ssl].to_s == 'false'
|
||||
if channel[:options].key?(:ssl) && channel[:options][:ssl].to_s == 'false'
|
||||
ssl = false
|
||||
port = 143
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class Channel::POP3 < Channel::EmailParser
|
|||
def fetch (channel, check_type = '', verify_string = '')
|
||||
ssl = true
|
||||
port = 995
|
||||
if channel[:options].has_key?(:ssl) && channel[:options][:ssl].to_s == 'false'
|
||||
if channel[:options].key?(:ssl) && channel[:options][:ssl].to_s == 'false'
|
||||
ssl = false
|
||||
port = 110
|
||||
end
|
||||
|
|
|
@ -74,19 +74,19 @@ class Link < ApplicationModel
|
|||
|
||||
def self.add(data)
|
||||
|
||||
if data.has_key?(:link_type)
|
||||
if data.key?(:link_type)
|
||||
linktype = self.link_type_get( name: data[:link_type] )
|
||||
data[:link_type_id] = linktype.id
|
||||
data.delete( :link_type )
|
||||
end
|
||||
|
||||
if data.has_key?(:link_object_source)
|
||||
if data.key?(:link_object_source)
|
||||
linkobject = self.link_object_get( name: data[:link_object_source] )
|
||||
data[:link_object_source_id] = linkobject.id
|
||||
data.delete( :link_object_source )
|
||||
end
|
||||
|
||||
if data.has_key?(:link_object_target)
|
||||
if data.key?(:link_object_target)
|
||||
linkobject = self.link_object_get( name: data[:link_object_target] )
|
||||
data[:link_object_target_id] = linkobject.id
|
||||
data.delete( :link_object_target )
|
||||
|
@ -108,18 +108,18 @@ class Link < ApplicationModel
|
|||
=end
|
||||
|
||||
def self.remove(data)
|
||||
if data.has_key?(:link_object_source)
|
||||
if data.key?(:link_object_source)
|
||||
linkobject = self.link_object_get( name: data[:link_object_source] )
|
||||
data[:link_object_source_id] = linkobject.id
|
||||
end
|
||||
|
||||
if data.has_key?(:link_object_target)
|
||||
if data.key?(:link_object_target)
|
||||
linkobject = self.link_object_get( name: data[:link_object_target] )
|
||||
data[:link_object_target_id] = linkobject.id
|
||||
end
|
||||
|
||||
# from one site
|
||||
if data.has_key?(:link_type)
|
||||
if data.key?(:link_type)
|
||||
linktype = self.link_type_get( name: data[:link_type] )
|
||||
data[:link_type_id] = linktype.id
|
||||
end
|
||||
|
@ -135,7 +135,7 @@ class Link < ApplicationModel
|
|||
}
|
||||
|
||||
# from the other site
|
||||
if data.has_key?(:link_type)
|
||||
if data.key?(:link_type)
|
||||
linktype = self.link_type_get( name: @map[ data[:link_type] ] )
|
||||
data[:link_type_id] = linktype.id
|
||||
end
|
||||
|
|
|
@ -61,7 +61,7 @@ class Setting < ApplicationModel
|
|||
|
||||
return if !(self.state || self.state == false)
|
||||
|
||||
return if !( !self.state.respond_to?('has_key?') || !self.state.has_key?(:value) )
|
||||
return if !( !self.state.respond_to?('has_key?') || !self.state.key?(:value) )
|
||||
|
||||
self.state = { value: self.state }
|
||||
end
|
||||
|
|
|
@ -69,7 +69,7 @@ module Import::OTRS
|
|||
}
|
||||
types.each {|config_key, result_key|
|
||||
if config[config_key]
|
||||
return false if !result[result_key].has_value?( config[config_key] )
|
||||
return false if !result[result_key].value?( config[config_key] )
|
||||
end
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ module Import::OTRS
|
|||
types.each {|config_key, result_key|
|
||||
next if !config[config_key]
|
||||
config[config_key].each {|otrs_group, role|
|
||||
next if !result[result_key].has_value?( otrs_group )
|
||||
next if !result[result_key].value?( otrs_group )
|
||||
role_ids = user.role_ids
|
||||
role = Role.where( name: role ).first
|
||||
next if !role
|
||||
|
|
|
@ -820,7 +820,7 @@ module Import::OTRS2
|
|||
updated_by_id: 1,
|
||||
}
|
||||
map.each { |key, value|
|
||||
if state.has_key?(key.to_s)
|
||||
if state.key?(key.to_s)
|
||||
state_new[value] = state[key.to_s]
|
||||
end
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ module Import::OTRS2
|
|||
updated_by_id: 1,
|
||||
}
|
||||
map.each { |key, value|
|
||||
if priority.has_key?(key.to_s)
|
||||
if priority.key?(key.to_s)
|
||||
priority_new[value] = priority[key.to_s]
|
||||
end
|
||||
}
|
||||
|
@ -910,7 +910,7 @@ module Import::OTRS2
|
|||
updated_by_id: 1,
|
||||
}
|
||||
map.each { |key, value|
|
||||
if group.has_key?(key.to_s)
|
||||
if group.key?(key.to_s)
|
||||
group_new[value] = group[key.to_s]
|
||||
end
|
||||
}
|
||||
|
@ -965,7 +965,7 @@ module Import::OTRS2
|
|||
group_ids: group_ids,
|
||||
}
|
||||
map.each { |key, value|
|
||||
if user.has_key?(key.to_s)
|
||||
if user.key?(key.to_s)
|
||||
user_new[value] = user[key.to_s]
|
||||
end
|
||||
}
|
||||
|
@ -1089,7 +1089,7 @@ module Import::OTRS2
|
|||
role_ids: [ role_customer.id ],
|
||||
}
|
||||
map.each { |key, value|
|
||||
if user.has_key?(key.to_s)
|
||||
if user.key?(key.to_s)
|
||||
user_new[value] = user[key.to_s]
|
||||
end
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ module Import::OTRS2
|
|||
updated_by_id: 1,
|
||||
}
|
||||
map.each { |key, value|
|
||||
if organization.has_key?(key.to_s)
|
||||
if organization.key?(key.to_s)
|
||||
organization_new[value] = organization[key.to_s]
|
||||
end
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ EventMachine.run {
|
|||
if data['recipient'].class != Hash
|
||||
log 'error', "recipient attribute isn't a hash '#{ data['recipient'].inspect }'"
|
||||
else
|
||||
if !data['recipient'].has_key?('user_id')
|
||||
if !data['recipient'].key?('user_id')
|
||||
log 'error', "need recipient.user_id attribute '#{ data['recipient'].inspect }'"
|
||||
else
|
||||
if data['recipient']['user_id'].class != Array
|
||||
|
|
Loading…
Reference in a new issue