module Conjur::Policy::Types::ActsAsCompoundId

Public Class Methods

new(kind_or_id = nil, id_or_options = nil) click to toggle source
# 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 ||= {}
    account, self.kind, self.id = kind_or_id.split(':', 3)
    self.account = account if account != id_or_options[:default_account]
  end
end

Public Instance Methods

==(other) click to toggle source
# File lib/conjur/policy/types/records.rb, line 99
def == other
  other.kind_of?(ActsAsCompoundId) && kind == other.kind && id == other.id && account == other.account
end
to_s() click to toggle source
# File lib/conjur/policy/types/records.rb, line 103
def to_s
  "#{kind} #{self.class.short_name.underscore} '#{id}'#{account && account != Conjur.configuration.account ? ' in account \'' + account + '\'': ''}"
end