mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Replace Hash#keys.each with Hash#each_key for some perf boost
This commit is contained in:
@@ -300,7 +300,7 @@ class PostRevisor
|
||||
return unless revision = PostRevision.find_by(post_id: @post.id, number: @post.version)
|
||||
revision.user_id = @post.last_editor_id
|
||||
modifications = post_changes.merge(@topic_changes.diff)
|
||||
modifications.keys.each do |field|
|
||||
modifications.each_key do |field|
|
||||
if revision.modifications.has_key?(field)
|
||||
old_value = revision.modifications[field][0]
|
||||
new_value = modifications[field][1]
|
||||
|
||||
@@ -33,7 +33,7 @@ class ScoreCalculator
|
||||
|
||||
def update_posts_score(min_topic_age)
|
||||
components = []
|
||||
@weightings.keys.each { |k| components << "COALESCE(#{k}, 0) * :#{k}" }
|
||||
@weightings.each_key { |k| components << "COALESCE(#{k}, 0) * :#{k}" }
|
||||
components = components.join(" + ")
|
||||
|
||||
builder = SqlBuilder.new(
|
||||
|
||||
@@ -16,7 +16,7 @@ class SiteSettings::YamlLoader
|
||||
|
||||
def load
|
||||
yaml = YAML.load_file(@file)
|
||||
yaml.keys.each do |category|
|
||||
yaml.each_key do |category|
|
||||
yaml[category].each do |setting_name, hash|
|
||||
if hash.is_a?(Hash)
|
||||
# Get default value for the site setting:
|
||||
|
||||
Reference in New Issue
Block a user