Class: ResourcePolicy::Policy::ActionPolicyConfiguration
- Inherits:
-
Object
- Object
- ResourcePolicy::Policy::ActionPolicyConfiguration
- Defined in:
- lib/resource_policy/policy/action_policy_configuration.rb
Overview
Stores configuration for action policy.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #allowed(options = {}) ⇒ Object
- #conditions ⇒ Object
- #configured? ⇒ Boolean
-
#initialize(name, policy_configuration:) ⇒ ActionPolicyConfiguration
constructor
A new instance of ActionPolicyConfiguration.
Constructor Details
#initialize(name, policy_configuration:) ⇒ ActionPolicyConfiguration
Returns a new instance of ActionPolicyConfiguration.
11 12 13 14 15 16 |
# File 'lib/resource_policy/policy/action_policy_configuration.rb', line 11 def initialize(name, policy_configuration:) @name = name.to_sym @policy_configuration = policy_configuration @extra_conditions = [] @configured = false end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/resource_policy/policy/action_policy_configuration.rb', line 9 def name @name end |
Instance Method Details
#allowed(options = {}) ⇒ Object
18 19 20 21 22 |
# File 'lib/resource_policy/policy/action_policy_configuration.rb', line 18 def allowed( = {}) @extra_conditions = (@extra_conditions + Array([:if])).uniq @configured = true self end |
#conditions ⇒ Object
24 25 26 |
# File 'lib/resource_policy/policy/action_policy_configuration.rb', line 24 def conditions policy_configuration.group_conditions + @extra_conditions end |
#configured? ⇒ Boolean
28 29 30 |
# File 'lib/resource_policy/policy/action_policy_configuration.rb', line 28 def configured? @configured end |