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.
426 427 428 429 |
# File 'lib/tuersteher.rb', line 426 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
431 432 433 434 435 436 |
# 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 ⇒ Object
438 439 440 |
# File 'lib/tuersteher.rb', line 438 def to_s "#{@negation && 'not.'}model(#{@clazz})" end |