Class: CanTango::PermissionEngine::Parser::Permissions

Inherits:
Object
  • Object
show all
Defined in:
lib/cantango/permission_engine/parser/permissions.rb

Instance Method Summary collapse

Constructor Details

#initializePermissions

Returns a new instance of Permissions.



6
7
# File 'lib/cantango/permission_engine/parser/permissions.rb', line 6

def initialize
end

Instance Method Details

#parse(key, obj) {|permission| ... } ⇒ Object

Yields:

  • (permission)


9
10
11
12
13
14
15
16
17
18
# File 'lib/cantango/permission_engine/parser/permissions.rb', line 9

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