class Conjur::Policy::CompactOutputResolver

Unsets attributes that make for more verbose YAML output. This class is used to compact YAML expectations in test cases. It expects pre-flattened input.

account attributes which match the provided account are set to nil. owner attributes which match the provided ownerid are removed.

Public Instance Methods

resolve(records) click to toggle source
# File lib/conjur/policy/resolver.rb, line 242
def resolve records
  traverse records, Set.new, method(:resolve_owner)
  traverse records, Set.new, method(:resolve_account)
end
resolve_account(record, visited) click to toggle source
# File lib/conjur/policy/resolver.rb, line 247
def resolve_account record, visited
  if record.respond_to?(:account) && record.respond_to?(:account=) && record.account && record.account == self.account
    record.remove_instance_variable :@account
  end
  traverse record.referenced_records, visited, method(:resolve_account)
end
resolve_owner(record, visited) click to toggle source
# File lib/conjur/policy/resolver.rb, line 254
def resolve_owner record, visited
  if record.respond_to?(:owner) && record.respond_to?(:owner=) && record.owner && record.owner.roleid == self.ownerid
    record.remove_instance_variable :@owner
  end
  traverse record.referenced_records, visited, method(:resolve_owner)
end