Corrected with rubocop cop 'Style/SymbolProc'.

This commit is contained in:
Thorsten Eckel 2015-05-07 12:25:16 +02:00
parent a87482c8dd
commit fc5e3696a2
9 changed files with 9 additions and 29 deletions

View file

@ -182,10 +182,6 @@ Rails/ActionFilter:
Description: 'Enforces consistent use of action filter methods.' Description: 'Enforces consistent use of action filter methods.'
Enabled: false Enabled: false
Style/SymbolProc:
Description: 'Use symbols as procs instead of blocks when possible.'
Enabled: false
Style/SignalException: Style/SignalException:
Description: 'Checks for proper usage of fail and raise.' Description: 'Checks for proper usage of fail and raise.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'

View file

@ -130,9 +130,7 @@ class Link < ApplicationModel
link_object_target_id: data[:link_object_target_id], link_object_target_id: data[:link_object_target_id],
link_object_target_value: data[:link_object_target_value] link_object_target_value: data[:link_object_target_value]
) )
links.each { |link| links.each(&:destroy)
link.destroy
}
# from the other site # from the other site
if data.key?(:link_type) if data.key?(:link_type)
@ -146,9 +144,7 @@ class Link < ApplicationModel
link_object_source_id: data[:link_object_target_id], link_object_source_id: data[:link_object_target_id],
link_object_source_value: data[:link_object_target_value] link_object_source_value: data[:link_object_target_value]
) )
links.each { |link| links.each(&:destroy)
link.destroy
}
end end
def self.link_type_get(data) def self.link_type_get(data)

View file

@ -19,9 +19,7 @@ class Observer::Organization::RefObjectTouch < ActiveRecord::Observer
return if Setting.get('import_mode') return if Setting.get('import_mode')
# touch organizations tickets # touch organizations tickets
Ticket.select('id').where( organization_id: record.id ).each {|ticket| Ticket.select('id').where( organization_id: record.id ).each(&:touch)
ticket.touch
}
# touch current members # touch current members
record.member_ids.uniq.each {|user_id| record.member_ids.uniq.each {|user_id|

View file

@ -43,9 +43,7 @@ class Tag < ApplicationModel
tag_item_id: tag_item_id, tag_item_id: tag_item_id,
o_id: data[:o_id], o_id: data[:o_id],
) )
result.each { |item| result.each(&:destroy)
item.destroy
}
true true
end end

View file

@ -128,9 +128,7 @@ returns
def merge_to(data) def merge_to(data)
# update articles # update articles
Ticket::Article.where( ticket_id: self.id ).each {|article| Ticket::Article.where( ticket_id: self.id ).each(&:touch)
article.touch
}
# quiet update of reassign of articles # quiet update of reassign of articles
Ticket::Article.where( ticket_id: self.id ).update_all( ['ticket_id = ?', data[:ticket_id] ] ) Ticket::Article.where( ticket_id: self.id ).update_all( ['ticket_id = ?', data[:ticket_id] ] )

View file

@ -18,9 +18,7 @@ returns
state_list_open = Ticket::State.by_category( 'open' ) state_list_open = Ticket::State.by_category( 'open' )
tickets = Ticket.where( state_id: state_list_open ) tickets = Ticket.where( state_id: state_list_open )
tickets.each {|ticket| tickets.each(&:escalation_calculation)
ticket.escalation_calculation
}
end end
=begin =begin

View file

@ -66,7 +66,7 @@ class String
# see also test/fixtures/mail21.box # see also test/fixtures/mail21.box
# note: string.encode!('UTF-8', 'UTF-8', :invalid => :replace, :replace => '?') was not detecting invalid chars # note: string.encode!('UTF-8', 'UTF-8', :invalid => :replace, :replace => '?') was not detecting invalid chars
if !string.valid_encoding? if !string.valid_encoding?
string = string.chars.select { |c| c.valid_encoding? }.join string = string.chars.select(&:valid_encoding?).join
end end
# find <a href=....> and replace it with [x] # find <a href=....> and replace it with [x]

View file

@ -52,9 +52,7 @@ class Sessions::Client
self.log "---client - looking for data of user #{user.id}" self.log "---client - looking for data of user #{user.id}"
# push messages from backends # push messages from backends
backend_pool.each {|pool| backend_pool.each(&:push)
pool.push
}
self.log '---/client-' self.log '---/client-'

View file

@ -30,9 +30,7 @@ class TwitterTest < ActiveSupport::TestCase
# add channel # add channel
current = Channel.where( adapter: 'Twitter2' ) current = Channel.where( adapter: 'Twitter2' )
current.each {|r| current.each(&:destroy)
r.destroy
}
Channel.create( Channel.create(
adapter: 'Twitter2', adapter: 'Twitter2',
area: 'Twitter::Inbound', area: 'Twitter::Inbound',