From 34c322f8c0403bc89b3340ed1f71683acbbb53e1 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 25 Dec 2023 14:01:09 +0100 Subject: [PATCH] Fix Rubocop offenses --- app/models/code_ocean/file.rb | 2 +- app/models/file_type.rb | 4 ++-- db/seeds.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/code_ocean/file.rb b/app/models/code_ocean/file.rb index 4282a640..38b60bf2 100644 --- a/app/models/code_ocean/file.rb +++ b/app/models/code_ocean/file.rb @@ -64,7 +64,7 @@ module CodeOcean validates_with FileNameValidator, fields: %i[name path file_type_id] ROLES.each do |role| - define_method("#{role}?") { self.role == role } + define_method(:"#{role}?") { self.role == role } end def read diff --git a/app/models/file_type.rb b/app/models/file_type.rb index 79d2ad0a..f30043b6 100644 --- a/app/models/file_type.rb +++ b/app/models/file_type.rb @@ -29,8 +29,8 @@ class FileType < ApplicationRecord validates :file_extension, length: {minimum: 0, allow_nil: false} %i[audio compressed csv excel image pdf powerpoint video word].each do |type| - define_method("#{type}?") do - self.class.const_get("#{type.upcase}_FILE_EXTENSIONS").include?(file_extension) + define_method(:"#{type}?") do + self.class.const_get(:"#{type.upcase}_FILE_EXTENSIONS").include?(file_extension) end end diff --git a/db/seeds.rb b/db/seeds.rb index fa5246b0..758fc503 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -17,7 +17,7 @@ end module ActiveRecord class Base %i[build create].each do |strategy| - define_singleton_method("#{strategy}_factories") do |attributes = {}| + define_singleton_method(:"#{strategy}_factories") do |attributes = {}| find_factories_by_class(self).map(&:name).map do |factory_name| FactoryBot.send(strategy, factory_name, attributes) end