Module: Hai::Policies::ClassMethods

Defined in:
lib/hai/policies.rb

Instance Method Summary collapse

Instance Method Details

#policiesObject



14
15
16
# File 'lib/hai/policies.rb', line 14

def policies
  @policies ||= {}
end

#policy(action, &block) ⇒ Object

TODO: validate CRUD actions



19
20
21
22
23
# File 'lib/hai/policies.rb', line 19

def policy(action, &block)
  policies[action] = lambda do |instance, context|
    block.call(instance, context)
  end
end