class ChefCLI::Policyfile::RevIDLockDataMap

def all_cookbook_names

def all_cookbook_names
  lock_info_by_rev_id.inject(Set.new) do |cb_set, (_rev_id, rev_info)|
    cb_set.merge(rev_info["cookbook_locks"].keys)
  end
end

def cb_info_for(rev_id, cookbook_name)

def cb_info_for(rev_id, cookbook_name)
  lock = lock_info_by_rev_id[rev_id]
  cookbook_lock = lock["cookbook_locks"][cookbook_name]
  if cookbook_lock
    [cookbook_lock["version"], cookbook_lock["identifier"] ]
  else
    nil
  end
end

def cbs_with_differing_ids

def cbs_with_differing_ids
  cbs_with_differing_ids = Set.new
  all_cookbook_names.each do |cookbook_name|
    all_identifiers = lock_info_by_rev_id.inject(Set.new) do |id_set, (_rev_id, rev_info)|
      cookbook_lock = rev_info["cookbook_locks"][cookbook_name]
      identifier = cookbook_lock && cookbook_lock["identifier"]
      id_set << identifier
    end
    cbs_with_differing_ids << cookbook_name if all_identifiers.size > 1
  end
  cbs_with_differing_ids
end

def initialize(policy_name, lock_info_by_rev_id)

def initialize(policy_name, lock_info_by_rev_id)
  @policy_name = policy_name
  @lock_info_by_rev_id = lock_info_by_rev_id
end