Method: Chef::CookbookVersion.from_hash

Defined in:
lib/chef/cookbook_version.rb

.from_hash(o) ⇒ Object



478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/chef/cookbook_version.rb', line 478

def self.from_hash(o)
  cookbook_version = new(o["cookbook_name"] || o["name"])

  # We want the Chef::Cookbook::Metadata object to always be inflated
  cookbook_version.manifest = o
  cookbook_version. = Chef::Cookbook::.from_hash(o["metadata"])
  cookbook_version.identifier = o["identifier"] if o.key?("identifier")

  # We don't need the following step when we decide to stop supporting deprecated operators in the metadata (e.g. <<, >>)
  cookbook_version.manifest["metadata"] = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(cookbook_version.))

  cookbook_version.freeze_version if o["frozen?"]
  cookbook_version
end