From f84037ae2bb9c2bf046c183885592f96775d2fd5 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 1 Jun 2023 03:47:05 -0400 Subject: [PATCH] Remove unused #hash_to_object method in SettingsHelper (#25213) --- app/helpers/settings_helper.rb | 4 ---- app/lib/hash_object.rb | 10 ---------- spec/lib/hash_object_spec.rb | 9 --------- 3 files changed, 23 deletions(-) delete mode 100644 app/lib/hash_object.rb delete mode 100644 spec/lib/hash_object_spec.rb diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index 3d5592867..ae89cec78 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -5,10 +5,6 @@ module SettingsHelper LanguagesHelper::SUPPORTED_LOCALES.keys end - def hash_to_object(hash) - HashObject.new(hash) - end - def session_device_icon(session) device = session.detection.device diff --git a/app/lib/hash_object.rb b/app/lib/hash_object.rb deleted file mode 100644 index 274c020ad..000000000 --- a/app/lib/hash_object.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class HashObject - def initialize(hash) - hash.each do |k, v| - instance_variable_set("@#{k}", v) - self.class.send(:define_method, k, proc { instance_variable_get("@#{k}") }) - end - end -end diff --git a/spec/lib/hash_object_spec.rb b/spec/lib/hash_object_spec.rb deleted file mode 100644 index ce1806520..000000000 --- a/spec/lib/hash_object_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe HashObject do - it 'has methods corresponding to hash properties' do - expect(HashObject.new(key: 'value').key).to eq 'value' - end -end