Class: Conjur::Policy::CompactOutputResolver
- Defined in:
- lib/conjur/policy/resolver.rb
Overview
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.
Instance Attribute Summary
Attributes inherited from Resolver
#account, #namespace, #ownerid
Instance Method Summary collapse
- #resolve(records) ⇒ Object
- #resolve_account(record, visited) ⇒ Object
- #resolve_owner(record, visited) ⇒ Object
Methods inherited from Resolver
Constructor Details
This class inherits a constructor from Conjur::Policy::Resolver
Instance Method Details
#resolve(records) ⇒ Object
221 222 223 224 |
# File 'lib/conjur/policy/resolver.rb', line 221 def resolve records traverse records, Set.new, method(:resolve_owner) traverse records, Set.new, method(:resolve_account) end |
#resolve_account(record, visited) ⇒ Object
226 227 228 229 230 231 |
# File 'lib/conjur/policy/resolver.rb', line 226 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) ⇒ Object
233 234 235 236 237 238 |
# File 'lib/conjur/policy/resolver.rb', line 233 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 |