From: Tom Hughes Date: Tue, 16 Feb 2021 21:14:54 +0000 (+0000) Subject: Fix new rubocop warnings X-Git-Tag: live~1774 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/2d50a840049e0634ebc548026c41a397747af061 Fix new rubocop warnings --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index db8b51f5c..c8473adfc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -9,12 +9,12 @@ module ApplicationHelper end end - def rss_link_to(*args) - link_to(image_tag("RSS.png", :size => "16x16", :border => 0), Hash[*args], :class => "rsssmall") + def rss_link_to(args = {}) + link_to(image_tag("RSS.png", :size => "16x16", :border => 0), args, :class => "rsssmall") end - def atom_link_to(*args) - link_to(image_tag("RSS.png", :size => "16x16", :border => 0), Hash[*args], :class => "rsssmall") + def atom_link_to(args = {}) + link_to(image_tag("RSS.png", :size => "16x16", :border => 0), args, :class => "rsssmall") end def richtext_area(object_name, method, options = {}) diff --git a/app/models/node.rb b/app/models/node.rb index a5346e87f..5e799c8d9 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -207,7 +207,7 @@ class Node < ApplicationRecord end def tags - @tags ||= Hash[node_tags.collect { |t| [t.k, t.v] }] + @tags ||= node_tags.collect { |t| [t.k, t.v] }.to_h end attr_writer :tags diff --git a/app/models/old_node.rb b/app/models/old_node.rb index fe1a90013..620cc24d2 100644 --- a/app/models/old_node.rb +++ b/app/models/old_node.rb @@ -105,7 +105,7 @@ class OldNode < ApplicationRecord end def tags - @tags ||= Hash[old_tags.collect { |t| [t.k, t.v] }] + @tags ||= old_tags.collect { |t| [t.k, t.v] }.to_h end attr_writer :tags diff --git a/app/models/old_relation.rb b/app/models/old_relation.rb index bfbe673b0..51aeb9c4c 100644 --- a/app/models/old_relation.rb +++ b/app/models/old_relation.rb @@ -83,7 +83,7 @@ class OldRelation < ApplicationRecord end def tags - @tags ||= Hash[old_tags.collect { |t| [t.k, t.v] }] + @tags ||= old_tags.collect { |t| [t.k, t.v] }.to_h end attr_writer :members, :tags diff --git a/app/models/old_way.rb b/app/models/old_way.rb index 247123005..3260f2a1f 100644 --- a/app/models/old_way.rb +++ b/app/models/old_way.rb @@ -81,7 +81,7 @@ class OldWay < ApplicationRecord end def tags - @tags ||= Hash[old_tags.collect { |t| [t.k, t.v] }] + @tags ||= old_tags.collect { |t| [t.k, t.v] }.to_h end attr_writer :nds, :tags diff --git a/app/models/relation.rb b/app/models/relation.rb index 5ed838e10..365ea533e 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -131,7 +131,7 @@ class Relation < ApplicationRecord end def tags - @tags ||= Hash[relation_tags.collect { |t| [t.k, t.v] }] + @tags ||= relation_tags.collect { |t| [t.k, t.v] }.to_h end attr_writer :members, :tags diff --git a/app/models/way.rb b/app/models/way.rb index 0150a2ee3..7bb82b281 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -113,7 +113,7 @@ class Way < ApplicationRecord end def tags - @tags ||= Hash[way_tags.collect { |t| [t.k, t.v] }] + @tags ||= way_tags.collect { |t| [t.k, t.v] }.to_h end attr_writer :nds, :tags