Module: Chef::ResourceCollection::ResourceCollectionSerialization::ClassMethods

Defined in:
lib/chef/resource_collection/resource_collection_serialization.rb

Instance Method Summary collapse

Instance Method Details

#from_hash(o) ⇒ Object


47
48
49
50
51
52
53
# File 'lib/chef/resource_collection/resource_collection_serialization.rb', line 47

def from_hash(o)
  collection = new
  o["instance_vars"].each do |k, v|
    collection.instance_variable_set(k.to_sym, v)
  end
  collection
end

#from_json(j) ⇒ Object


55
56
57
# File 'lib/chef/resource_collection/resource_collection_serialization.rb', line 55

def from_json(j)
  from_hash(Chef::JSONCompat.parse(j))
end