Sha256: e60c75ebc42c147ceabd83dfb64368fe843f10eaa3b4c7b3c0943f664728eda2
Contents?: true
Size: 543 Bytes
Versions: 2
Compression:
Stored size: 543 Bytes
Contents
module Gitlab # Converts hashes to the objects. class ObjectifiedHash # Creates a new ObjectifiedHash object. def initialize(hash) @hash = hash @data = hash.inject({}) do |data, (key,value)| value = ObjectifiedHash.new(value) if value.is_a? Hash data[key.to_s] = value data end end def to_hash @hash end alias_method :to_h, :to_hash # Delegate to ObjectifiedHash. def method_missing(key) @data.key?(key.to_s) ? @data[key.to_s] : nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gitlab-3.2.0 | lib/gitlab/objectified_hash.rb |
gitlab-3.1.0 | lib/gitlab/objectified_hash.rb |