Module: Happy::Controller::Permissions

Included in:
Happy::Controller
Defined in:
lib/happy/controller/permissions.rb

Instance Method Summary collapse

Instance Method Details

#permissions(&blk) ⇒ Object Also known as: can



6
7
8
9
10
11
12
# File 'lib/happy/controller/permissions.rb', line 6

def permissions(&blk)
  (@env['happy.permissions'] ||= Allowance::Permissions.new).tap do |p|
    if blk
      blk.arity == 0 ? p.instance_exec(&blk) : blk.call(p)
    end
  end
end