class Grant::Config

Attributes

actions[R]

Public Class Methods

new(*args) click to toggle source
# File lib/grant/config.rb, line 9
def initialize(*args)
  @actions = args.map(&:to_sym)
  validate_actions(@actions)
end
valid_actions() click to toggle source
# File lib/grant/config.rb, line 5
def self.valid_actions
  @valid_actions ||= [:create, :find, :update, :destroy]
end

Private Instance Methods

validate_actions(actions) click to toggle source
# File lib/grant/config.rb, line 16
def validate_actions(actions)
  raise Grant::Error.new "at least one action in #{Config.valid_actions.inspect} must be specified" if actions.empty?
  raise Grant::Error.new "#{Config.valid_actions.inspect} are the only valid actions" unless actions.all? { |a| Config.valid_actions.include?(a.to_sym) }
end