]> git.openstreetmap.org Git - rails.git/commitdiff
Fix new rubocop warnings
authorTom Hughes <tom@compton.nu>
Tue, 16 Nov 2021 08:30:04 +0000 (08:30 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 16 Nov 2021 08:48:35 +0000 (08:48 +0000)
app/helpers/reports_helper.rb

index f9cc996210d7b419267d3879bf123b8c0a45966c..57b786792106f40eab119d2716b98cf8e1417c71 100644 (file)
@@ -1,6 +1,8 @@
 require "ostruct"
 
 module ReportsHelper
+  Category = Struct.new(:id, :label)
+
   def report_link(name, reportable)
     link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name)
   end
@@ -8,7 +10,7 @@ module ReportsHelper
   # Convert a list of strings into objects with methods that the collection_radio_buttons helper expects
   def report_categories(reportable)
     Report.categories_for(reportable).map do |c|
-      OpenStruct.new(:id => c, :label => t(".categories.#{reportable.class.name.underscore}.#{c}_label"))
+      Category.new(c, t(".categories.#{reportable.class.name.underscore}.#{c}_label"))
     end
   end
 end