Class: DeclarativePolicy::PreventAllDsl

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializePreventAllDsl

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

#exceptionsObject (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