Class: PostPolicy::AccessManager
- Inherits:
-
Object
- Object
- PostPolicy::AccessManager
- Includes:
- EventMachine::Deferrable
- Defined in:
- lib/postpolicy/access_manager.rb
Constant Summary collapse
- DEFAULT_ACTION =
"DUNNO"- @@access_list =
[]
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.<<(action) ⇒ Object
18 19 20 |
# File 'lib/postpolicy/access_manager.rb', line 18 def self.<<( action ) @@access_list << action end |
.access_list ⇒ Object
14 15 16 |
# File 'lib/postpolicy/access_manager.rb', line 14 def self.access_list @@access_list end |
Instance Method Details
#check(args) {|action| ... } ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/postpolicy/access_manager.rb', line 22 def check( args ) action = DEFAULT_ACTION @@access_list.each do |access| if access.match?( args ) action = access.action break end end yield action if block_given? return action end |