Module: Conjur::Policy::Ruby::RecordReferenceFactory
Overview
Implement method_missing
to reference basic types like Group, User, Layer, etc. Anything from Conjur::Policy::Types is fair game.
Instance Method Summary collapse
- #handle_object(object, &block) ⇒ Object
-
#method_missing(sym, *args, &block) ⇒ Object
The record can have a constructor with 0 or 1 arguments.
Methods included from RecordLoader
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
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.
25 26 27 28 29 30 31 32 33 34 35 |
# 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 |
Instance Method Details
#handle_object(object, &block) ⇒ Object
37 38 39 |
# File 'lib/conjur/policy/ruby/loader.rb', line 37 def handle_object object, &block # pass end |