about summary refs log tree commit diff
path: root/app/lib/hash_object.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/hash_object.rb')
-rw-r--r--app/lib/hash_object.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/lib/hash_object.rb b/app/lib/hash_object.rb
new file mode 100644
index 000000000..274c020ad
--- /dev/null
+++ b/app/lib/hash_object.rb
@@ -0,0 +1,10 @@
+# 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