Sha256: 38b5ab37a47f543f8fa3e69f083a8e8418fd4784ea483b1761ac616119761cc2
Contents?: true
Size: 789 Bytes
Versions: 26
Compression:
Stored size: 789 Bytes
Contents
module RoleAuthorization module Rules class Rule attr_accessor :role, :options attr_accessor :returning # for calls to authorized? attr_accessor :controller_instance, :controller, :action, :id def initialize(*options, &block) @returning = block @options, @role = if options.is_a?(Hash) [options, nil] elsif options.last.is_a?(Hash) [options.pop, options.first] else [{}, options.first] end self end def authorized?(*args) @controller_instance, @controller, @action, @id = args instance_eval(&returning) end end end end
Version data entries
26 entries across 26 versions & 1 rubygems