summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-08-01 14:28:39 +0000
committerGo MAEDA <maeda@farend.jp>2018-08-01 14:28:39 +0000
commited14823d13ae156e5040bd94c400010b92216af0 (patch)
treeedfed74bf367356f794589b6c7c4713a39792bcf
parent1e0663de9d0d81cd4e508cab77a309129b311f83 (diff)
downloadredmine-ed14823d13ae156e5040bd94c400010b92216af0.tar.gz
redmine-ed14823d13ae156e5040bd94c400010b92216af0.zip
Replace Hash#keys.each with faster Hash#each_key (#29305).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17458 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue_query.rb2
-rw-r--r--app/models/query.rb4
-rw-r--r--app/models/user_preference.rb2
-rw-r--r--lib/plugins/open_id_authentication/lib/open_id_authentication.rb2
-rw-r--r--lib/redmine/helpers/gantt.rb2
5 files changed, 6 insertions, 6 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index ad5e511af..c342dc456 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -582,7 +582,7 @@ class IssueQuery < Query
end
alias :find_author_id_filter_values :find_assigned_to_id_filter_values
- IssueRelation::TYPES.keys.each do |relation_type|
+ IssueRelation::TYPES.each_key do |relation_type|
alias_method "sql_for_#{relation_type}_field".to_sym, :sql_for_relations
end
diff --git a/app/models/query.rb b/app/models/query.rb
index f85fd0f65..ed11bbffb 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -371,7 +371,7 @@ class Query < ActiveRecord::Base
self.filters = {}
add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v])
else
- available_filters.keys.each do |field|
+ available_filters.each_key do |field|
add_short_filter(field, params[field]) if params[field]
end
end
@@ -989,7 +989,7 @@ class Query < ActiveRecord::Base
def map_total(total, &block)
if total.is_a?(Hash)
- total.keys.each {|k| total[k] = yield total[k]}
+ total.each_key {|k| total[k] = yield total[k]}
else
total = yield total
end
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index efdc41e2d..7373290c5 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -122,7 +122,7 @@ class UserPreference < ActiveRecord::Base
# preferences.remove_block('news')
def remove_block(block)
block = block.to_s.underscore
- my_page_layout.keys.each do |group|
+ my_page_layout.each_key do |group|
my_page_layout[group].delete(block)
end
my_page_layout
diff --git a/lib/plugins/open_id_authentication/lib/open_id_authentication.rb b/lib/plugins/open_id_authentication/lib/open_id_authentication.rb
index 7afe6fdeb..e31aba1f2 100644
--- a/lib/plugins/open_id_authentication/lib/open_id_authentication.rb
+++ b/lib/plugins/open_id_authentication/lib/open_id_authentication.rb
@@ -61,7 +61,7 @@ module OpenIdAuthentication
@code
end
- ERROR_MESSAGES.keys.each { |state| define_method("#{state}?") { @code == state } }
+ ERROR_MESSAGES.each_key { |state| define_method("#{state}?") { @code == state } }
def successful?
@code == :successful
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index 756dc6e93..ca3b70b6f 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -608,7 +608,7 @@ module Redmine
end
end
# Transforms dates into pixels witdh
- coords.keys.each do |key|
+ coords.each_key do |key|
coords[key] = (coords[key] * zoom).floor
end
coords