Class: PickyGuard::StatementProxy
- Inherits:
-
Object
- Object
- PickyGuard::StatementProxy
- Defined in:
- lib/picky_guard/statement_proxy.rb
Instance Method Summary collapse
-
#actions(actions) ⇒ Object
rubocop:disable Style/TrivialAccessors.
- #allow ⇒ Object
- #build ⇒ Object
- #class_resource ⇒ Object
- #conditions(conditions) ⇒ Object
- #deny ⇒ Object
-
#initialize(resource) ⇒ StatementProxy
constructor
A new instance of StatementProxy.
-
#instance_resource ⇒ Object
rubocop:enable Style/TrivialAccessors.
- #validate! ⇒ Object
Constructor Details
#initialize(resource) ⇒ StatementProxy
Returns a new instance of StatementProxy.
7 8 9 10 11 |
# File 'lib/picky_guard/statement_proxy.rb', line 7 def initialize(resource) @resource = resource allow instance_resource end |
Instance Method Details
#actions(actions) ⇒ Object
rubocop:disable Style/TrivialAccessors
22 23 24 |
# File 'lib/picky_guard/statement_proxy.rb', line 22 def actions(actions) @actions = actions end |
#allow ⇒ Object
13 14 15 |
# File 'lib/picky_guard/statement_proxy.rb', line 13 def allow @effect = PickyGuard::Statement::EFFECT_ALLOW end |
#build ⇒ Object
46 47 48 49 |
# File 'lib/picky_guard/statement_proxy.rb', line 46 def build validate! build_statement end |
#class_resource ⇒ Object
35 36 37 |
# File 'lib/picky_guard/statement_proxy.rb', line 35 def class_resource @resource_type = PickyGuard::Statement::RESOURCE_TYPE_CLASS end |
#conditions(conditions) ⇒ Object
26 27 28 |
# File 'lib/picky_guard/statement_proxy.rb', line 26 def conditions(conditions) @conditions = conditions end |
#deny ⇒ Object
17 18 19 |
# File 'lib/picky_guard/statement_proxy.rb', line 17 def deny @effect = PickyGuard::Statement::EFFECT_DENY end |
#instance_resource ⇒ Object
rubocop:enable Style/TrivialAccessors
31 32 33 |
# File 'lib/picky_guard/statement_proxy.rb', line 31 def instance_resource @resource_type = PickyGuard::Statement::RESOURCE_TYPE_INSTANCE end |
#validate! ⇒ Object
39 40 41 42 43 44 |
# File 'lib/picky_guard/statement_proxy.rb', line 39 def validate! Validator.validate_effect!(@effect) Validator.validate_all_actions!(@actions) Validator.validate_resource_class!(@resource) Validator.validate_conditions!(@conditions) if instance_resource? end |