Class: ActionGuard::Syntax
- Inherits:
-
Object
- Object
- ActionGuard::Syntax
- Defined in:
- lib/action-guard/syntax.rb
Instance Method Summary collapse
- #allow(path, options = {}, &block) ⇒ Object
-
#initialize(action_guard) ⇒ Syntax
constructor
A new instance of Syntax.
- #role(role_value, role_level) ⇒ Object
Constructor Details
#initialize(action_guard) ⇒ Syntax
Returns a new instance of Syntax.
3 4 5 |
# File 'lib/action-guard/syntax.rb', line 3 def initialize(action_guard) @guard = action_guard end |
Instance Method Details
#allow(path, options = {}, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/action-guard/syntax.rb', line 9 def allow(path, ={}, &block) if .has_key? :at_least @guard.leveled_rule(path, [:at_least], [:at_most], &block) elsif .has_key? :only_by @guard.exact_role_rule(path, [:only_by]) else @guard.allow_rule(path, &block) end end |
#role(role_value, role_level) ⇒ Object
6 7 8 |
# File 'lib/action-guard/syntax.rb', line 6 def role(role_value, role_level) @guard.define_role(role_value, role_level) end |