module Conjur::Policy::Ruby::RecordReferenceFactory

Implement method_missing to reference basic types like Group, User, Layer, etc. Anything from Conjur::Policy::Types is fair game.

Public Instance Methods

handle_object(object, &block) click to toggle source
# File lib/conjur/policy/ruby/loader.rb, line 37
def handle_object object, &block
  # pass
end
method_missing(sym, *args, &block) click to toggle source

The record can have a constructor with 0 or 1 arguments. If it takes 1 argument, it will be populated with the first args, if any. It's assumed to be the id.

Calls superclass method
# File lib/conjur/policy/ruby/loader.rb, line 25
def method_missing sym, *args, &block
  kind = Conjur::Policy::Types.const_get sym.to_s.classify rescue nil
  if kind
    object = kind.new(*args)
    raise "#{kind.short_name} is not createable here" unless object.role? || object.resource?
    handle_object object, &block
    object
  else
    super
  end
end