Sha256: fc648d45c54c10a3684098ecadfb7a94fa86a73a56801b53556a67d436cd7449
Contents?: true
Size: 706 Bytes
Versions: 1
Compression:
Stored size: 706 Bytes
Contents
module Heimdallr module Model extend ActiveSupport::Concern module ClassMethods def restrict(&block) @restrictions = Evaluator.new(self, &block) end def restricted? !@restrictions.nil? end def restrictions(context) @restrictions.evaluate(context) end end module InstanceMethods def to_proxy(context, action) if self.class.restricted? Proxy.new(context, action, self) else self end end def validate_action(context, action) if self.class.restricted? self.class.restrictions(context).validate(action, self) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heimdallr-0.0.1 | lib/heimdallr/model.rb |