Module: Hai::Policies

Defined in:
lib/hai/policies.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/hai/policies.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#check_hai_policy(action, context) ⇒ Object



7
8
9
10
11
# File 'lib/hai/policies.rb', line 7

def check_hai_policy(action, context)
  return true unless (policy = self.class.policies[action])

  policy.call(self, context)
end