aboutsummaryrefslogtreecommitdiff
blob: 14c93ef61331465c20a82d6fa608691119f08a88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
AllPermissions = [:create, :update, :destroy, :view, :edit]

def one_permission(permission,  &block)
    define_method("#{permission.to_s}_permitted?", &block)
end
def multi_permission(*permission_list,  &block)
  permission_list.flatten.each do |target|
    one_permission(target, &block)
  end
end
def single_permission(&block)
  multi_permission(AllPermissions, &block)
end