Class: PermissionsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/cancan-permits/loader/permissions_parser.rb

Instance Method Summary collapse

Constructor Details

#initializePermissionsParser

Returns a new instance of PermissionsParser.



2
3
# File 'lib/cancan-permits/loader/permissions_parser.rb', line 2

def initialize
end

Instance Method Details

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

Yields:

  • (license)


5
6
7
8
9
10
11
12
13
14
# File 'lib/cancan-permits/loader/permissions_parser.rb', line 5

def parse(key, obj, &blk)
  license = ::PermissionConfig.new key
  case obj
  when Hash
    parse_permission(obj, license, &blk)
  else
    raise "Each key must have a YAML hash that defines its permission configuration"
  end
  yield license if blk
end