Class: Qwe::Proxy::Hash

Inherits:
Hash
  • Object
show all
Defined in:
lib/qwe/proxy/hash.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_hash(thing, name, hash = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/qwe/proxy/hash.rb', line 13

def self.from_hash(thing, name, hash = {})
  if hash.is_a?(Qwe::Proxy::Hash)
    hash
  else
    h = new
    h.replace(hash)
    h.__qwe_thing = thing
    h.__qwe_name = name
    h
  end
end

Instance Method Details

#to_rbObject



25
26
27
# File 'lib/qwe/proxy/hash.rb', line 25

def to_rb
  "Qwe::Proxy::Hash.from_hash(#{__qwe_thing.to_rb}, :#{__qwe_name}, #{super})"
end