Class: DeclarativePolicy::PreventAllDsl
- Inherits:
-
Object
- Object
- DeclarativePolicy::PreventAllDsl
- Defined in:
- lib/declarative_policy/prevent_all_dsl.rb
Overview
A small DSL class used within a prevent_all { ... } block to capture exception abilities.
Usage:
rule { some_condition }.prevent_all do
except :read
except :list
end
Instance Attribute Summary collapse
-
#exceptions ⇒ Object
readonly
Returns the value of attribute exceptions.
Instance Method Summary collapse
- #except(*abilities) ⇒ Object
-
#initialize ⇒ PreventAllDsl
constructor
A new instance of PreventAllDsl.
Constructor Details
#initialize ⇒ PreventAllDsl
Returns a new instance of PreventAllDsl.
17 18 19 |
# File 'lib/declarative_policy/prevent_all_dsl.rb', line 17 def initialize @exceptions = Set.new end |
Instance Attribute Details
#exceptions ⇒ Object (readonly)
Returns the value of attribute exceptions.
15 16 17 |
# File 'lib/declarative_policy/prevent_all_dsl.rb', line 15 def exceptions @exceptions end |
Instance Method Details
#except(*abilities) ⇒ Object
21 22 23 |
# File 'lib/declarative_policy/prevent_all_dsl.rb', line 21 def except(*abilities) @exceptions.merge(abilities) end |