class Tuersteher::ModelSpecification

Public Class Methods

new(clazz, negation) click to toggle source
# File lib/tuersteher.rb, line 426
def initialize clazz, negation
  clazz = clazz.name if clazz.is_a?(Class)
  @clazz, @negation = clazz, negation
end

Public Instance Methods

grant?(path_or_model, method, login_ctx) click to toggle source
# File lib/tuersteher.rb, line 431
def grant? path_or_model, method, login_ctx
  m_class = path_or_model.instance_of?(Class) ? path_or_model.name : path_or_model.class.name
  rc = @clazz == m_class
  rc = !rc if @negation
  rc
end
to_s() click to toggle source
# File lib/tuersteher.rb, line 438
def to_s
  "#{@negation && 'not.'}model(#{@clazz})"
end