Sha256: cea7f6c4687ee9e0e0973a19247fac618addd5ea3763e76999d9766f932fe102
Contents?: true
Size: 989 Bytes
Versions: 1
Compression:
Stored size: 989 Bytes
Contents
module CanTango module PermissionEngine module Parser class Permissions def initialize end def parse(key, obj, &blk) permission = CanTango::PermissionEngine::Permission.new key case obj when Hash parse_permission(obj, permission, &blk) else raise "Each key must have a YAML hash that defines its permission configuration" end yield permission if blk end protected # set :can and :cannot on permission with the permission rule def parse_permission(obj, permission, &blk) # Forget keys because I don't know what to do with them obj.each do |key, value| raise ArgumentError, "A CanTango permissions .yml file can only have the keys can: and cannot:" if ![:can, :cannot].include?(key.to_sym) permission.static_rules.send :"#{key}=", value end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cantango-0.8.0 | lib/cantango/permission_engine/parser/permissions.rb |