class Exits::Rules::User

Public Class Methods

new() click to toggle source
# File lib/exits/rules/user.rb, line 5
def initialize
  @actions = []
end

Public Instance Methods

allow(*actions) click to toggle source
# File lib/exits/rules/user.rb, line 9
def allow(*actions)
  @actions = @actions | actions.flatten

  if @actions.size > 1 && @actions.include?(:all)
    raise Exits::Rules::ConfusingRulesError, "You have :all and specific actions within the same controller/user rule."
  end
end
authorized?(action) click to toggle source
# File lib/exits/rules/user.rb, line 17
def authorized?(action)
  return true if @actions.include?(:all)
  return @actions.include?(action)
end