Module: Conjur::Policy::Types::ActsAsCompoundId

Included in:
Resource, Role
Defined in:
lib/conjur/policy/types/records.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



99
100
101
# File 'lib/conjur/policy/types/records.rb', line 99

def == other
  other.kind_of?(ActsAsCompoundId) && kind == other.kind && id == other.id &&  == other.
end

#initialize(kind_or_id = nil, id_or_options = nil) ⇒ Object



88
89
90
91
92
93
94
95
96
97
# File 'lib/conjur/policy/types/records.rb', line 88

def initialize kind_or_id = nil, id_or_options = nil
  if kind_or_id && id_or_options && id_or_options.is_a?(String)
    self.kind = kind_or_id
    self.id = id_or_options
  elsif kind_or_id && kind_or_id.index(":")
    id_or_options ||= {}
    , self.kind, self.id = kind_or_id.split(':', 3)
    self. =  if  != id_or_options[:default_account]
  end
end

#to_sObject



103
104
105
# File 'lib/conjur/policy/types/records.rb', line 103

def to_s
  "#{kind} #{self.class.short_name.underscore} '#{id}'#{ &&  != Conjur.configuration. ? ' in account \'' +  + '\'': ''}"
end