class Denied::Restriction

Attributes

actions[RW]
allow_if[RW]
role[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/denied/restriction.rb, line 5
def initialize(*args)
  options   = args.extract_options!
  @role     = options[:role]
  @allow_if = options[:allow_if]
  @actions  = args
  actions.empty? and raise ArgumentError, "expected actions to restrict, but got #{actions.inspect}"
end

Public Instance Methods

restricts?(action_name) click to toggle source
# File lib/denied/restriction.rb, line 13
def restricts?(action_name)
  actions.include?(action_name.to_sym)
end