Class: Tuersteher::ModelSpecification
- Inherits:
-
Object
- Object
- Tuersteher::ModelSpecification
- Defined in:
- lib/tuersteher.rb
Instance Method Summary collapse
- #grant?(path_or_model, method, login_ctx) ⇒ Boolean
-
#initialize(clazz, negation) ⇒ ModelSpecification
constructor
A new instance of ModelSpecification.
- #to_s ⇒ Object
Constructor Details
#initialize(clazz, negation) ⇒ ModelSpecification
Returns a new instance of ModelSpecification.
424 425 426 427 |
# File 'lib/tuersteher.rb', line 424 def initialize clazz, negation clazz = clazz.name if clazz.is_a?(Class) @clazz, @negation = clazz, negation end |
Instance Method Details
#grant?(path_or_model, method, login_ctx) ⇒ Boolean
429 430 431 432 433 434 |
# File 'lib/tuersteher.rb', line 429 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 ⇒ Object
436 437 438 |
# File 'lib/tuersteher.rb', line 436 def to_s "#{@negation && 'not.'}model(#{@clazz})" end |