Class: Servus::Guards::StateGuard
- Inherits:
-
Servus::Guard
- Object
- Servus::Guard
- Servus::Guards::StateGuard
- Defined in:
- lib/servus/guards/state_guard.rb
Overview
Guard that ensures an attribute matches an expected value or one of several allowed values.
Instance Attribute Summary
Attributes inherited from Servus::Guard
Instance Method Summary collapse
-
#test(on:, check:, is:) ⇒ Boolean
Tests whether the attribute matches the expected value(s).
Methods inherited from Servus::Guard
derive_method_name, #error, error_code, execute!, execute?, http_status, inherited, #initialize, message, #message, #method_missing, register_guard_methods, #respond_to_missing?
Constructor Details
This class inherits a constructor from Servus::Guard
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Servus::Guard
Instance Method Details
#test(on:, check:, is:) ⇒ Boolean
Tests whether the attribute matches the expected value(s).
31 32 33 |
# File 'lib/servus/guards/state_guard.rb', line 31 def test(on:, check:, is:) # rubocop:disable Naming/MethodParameterName Array(is).include?(on.public_send(check)) end |