Class: Conjur::Policy::DuplicateResolver

Inherits:
Resolver show all
Defined in:
lib/conjur/policy/resolver.rb

Overview

Raises an exception if the same record is declared more than once.

Instance Attribute Summary

Attributes inherited from Resolver

#account, #namespace, #ownerid

Instance Method Summary collapse

Methods inherited from Resolver

#initialize, resolve

Constructor Details

This class inherits a constructor from Conjur::Policy::Resolver

Instance Method Details

#resolve(records) ⇒ Object



226
227
228
229
230
231
232
233
# File 'lib/conjur/policy/resolver.rb', line 226

def resolve records
  seen = Set.new
  Array(records).flatten.each do |record|
    if record.respond_to?(:id) && !seen.add?([ record.class.short_name, record.id ])
      raise "#{record} is declared more than once"
    end
  end
end