1
0

hash_object.rb 235 B

12345678910
  1. # frozen_string_literal: true
  2. class HashObject
  3. def initialize(hash)
  4. hash.each do |k, v|
  5. instance_variable_set("@#{k}", v)
  6. self.class.send(:define_method, k, proc { instance_variable_get("@#{k}") })
  7. end
  8. end
  9. end