Sha256: 4914ce0de0261ed5309942efd50614a90a998b60d83efceb9c4bd2c9e607c935
Contents?: true
Size: 638 Bytes
Versions: 3
Compression:
Stored size: 638 Bytes
Contents
module Authority module UserAbilities # Should be included into whatever class represents users in an app. # Provides methods like `can_update?(resource)` # Exactly which methods get defined is determined from `config.abilities`; # the module is evaluated after any user-supplied config block is run # in order to make that possible. # All delegate to corresponding methods on the resource. Authority.verbs.each do |verb| class_eval <<-RUBY, __FILE__, __LINE__ + 1 def can_#{verb}?(resource) resource.#{Authority.abilities[verb]}_by?(self) end RUBY end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
authority-2.0.1 | lib/authority/user_abilities.rb |
authority-2.0.0 | lib/authority/user_abilities.rb |
authority-1.1.0 | lib/authority/user_abilities.rb |