Sha256: 4b9ec61dc5d50fd43964775492df851d3f3ef0357e1ffc07e7b59b8a70c69c01
Contents?: true
Size: 691 Bytes
Versions: 1
Compression:
Stored size: 691 Bytes
Contents
require_relative('../reuser') module ReUser class Role attr_reader :actions def initialize(name) @actions = {} end def can(*names) names.each do |name| action(name) end end def can?(name) actions[name] end def could(*names, &test) names.each do |name| action(name, test) end end def could?(name, data) @actions[name] == Proc ? @actions[name].call(data) : true end private def actions(*names) names.each do |name| action(name) end @actions end def action(name, test = true) @actions[name] = test end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reuser-0.2.2 | lib/reuser/role.rb |