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
- #==(other) ⇒ Object
-
#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.
41 42 43 |
# File 'lib/parametric/policy_adapter.rb', line 41 def initialize(policy) @policy = policy end |
Instance Method Details
#==(other) ⇒ Object
65 66 67 |
# File 'lib/parametric/policy_adapter.rb', line 65 def ==(other) key == other.key && == other. end |
#build(key, value, payload:, context:) ⇒ PolicyRunner
The PolicyFactory interface Buld a Policy Runner, which is instantiated for each field when resolving a schema
53 54 55 |
# File 'lib/parametric/policy_adapter.rb', line 53 def build(key, value, payload:, context:) PolicyRunner.new(@policy, key, value, payload, context) end |
#key ⇒ Object
61 62 63 |
# File 'lib/parametric/policy_adapter.rb', line 61 def key @policy.key end |
#meta_data ⇒ Object
57 58 59 |
# File 'lib/parametric/policy_adapter.rb', line 57 def @policy. end |