Sha256: 882b58ff1002aff608e990e7280fa7517a31322907a7ac7ebd97dcf5d9f03764
Contents?: true
Size: 766 Bytes
Versions: 5
Compression:
Stored size: 766 Bytes
Contents
module CanTango module Ability module Mode class InvalidError < StandardError; end class Base include CanTango::Ability::Executor attr_reader :ability delegate :session, :user, :subject, :candidate, :to => :ability delegate :can, :cannot, :can?, :cannot?, :rules, :to => :ability def initialize ability, options = {} @ability, @options = [ability, options] end def within_callbacks handle_callbacks :before raise CanTango::Ability::Mode::InvalidError, "Not valid mode: #{self.class}" if !valid? yield handle_callbacks :after rules end def valid? true end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems