Class: Parametric::PolicyAdapter
- Inherits:
-
Object
- Object
- Parametric::PolicyAdapter
- Defined in:
- lib/parametric/policy_adapter.rb
Overview
Adapt legacy policies to the new policy interface
Defined Under Namespace
Classes: PolicyRunner
Instance Method Summary collapse
-
#build(key, value, payload:, context:) ⇒ PolicyRunner
The PolicyFactory interface Buld a Policy Runner, which is instantiated for each field when resolving a schema.
-
#initialize(policy) ⇒ PolicyAdapter
constructor
A new instance of PolicyAdapter.
- #key ⇒ Object
- #meta_data ⇒ Object
Constructor Details
#initialize(policy) ⇒ PolicyAdapter
Returns a new instance of PolicyAdapter.
33 34 35 |
# File 'lib/parametric/policy_adapter.rb', line 33 def initialize(policy) @policy = policy end |
Instance Method Details
#build(key, value, payload:, context:) ⇒ PolicyRunner
The PolicyFactory interface Buld a Policy Runner, which is instantiated for each field when resolving a schema
45 46 47 |
# File 'lib/parametric/policy_adapter.rb', line 45 def build(key, value, payload:, context:) PolicyRunner.new(@policy, key, value, payload, context) end |
#key ⇒ Object
53 54 55 |
# File 'lib/parametric/policy_adapter.rb', line 53 def key @policy.key end |
#meta_data ⇒ Object
49 50 51 |
# File 'lib/parametric/policy_adapter.rb', line 49 def @policy. end |