Class: Micro::Authorization::Policy
- Inherits:
-
Object
- Object
- Micro::Authorization::Policy
- Defined in:
- lib/micro/authorization/policy.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context, subject = nil, permissions: nil) ⇒ Policy
constructor
A new instance of Policy.
- #method_missing(method, *args, **keyargs, &block) ⇒ Object
Constructor Details
#initialize(context, subject = nil, permissions: nil) ⇒ Policy
Returns a new instance of Policy.
12 13 14 15 16 |
# File 'lib/micro/authorization/policy.rb', line 12 def initialize(context, subject = nil, permissions: nil) @context = context @subject = subject @permissions = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, **keyargs, &block) ⇒ Object
18 19 20 21 |
# File 'lib/micro/authorization/policy.rb', line 18 def method_missing(method, *args, **keyargs, &block) return false if method =~ /\?\z/ super(method) end |
Class Method Details
.type(klass) ⇒ Object
6 7 8 9 10 |
# File 'lib/micro/authorization/policy.rb', line 6 def self.type(klass) return klass if klass < self raise ArgumentError, "policy must be a #{self.name}" end |