mirror of https://github.com/mastodon/mastodon
Remove unused #hash_to_object method in SettingsHelper (#25213)
This commit is contained in:
parent
e7e1b46ce8
commit
f84037ae2b
|
@ -5,10 +5,6 @@ module SettingsHelper
|
||||||
LanguagesHelper::SUPPORTED_LOCALES.keys
|
LanguagesHelper::SUPPORTED_LOCALES.keys
|
||||||
end
|
end
|
||||||
|
|
||||||
def hash_to_object(hash)
|
|
||||||
HashObject.new(hash)
|
|
||||||
end
|
|
||||||
|
|
||||||
def session_device_icon(session)
|
def session_device_icon(session)
|
||||||
device = session.detection.device
|
device = session.detection.device
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
Loading…
Reference in New Issue