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


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

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


53
54
55
# File 'lib/chef/resource_collection/resource_collection_serialization.rb', line 53

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