Class: GraphqlDevise::MountMethod::OptionValidators::SupportedOperationsValidator
- Inherits:
-
Object
- Object
- GraphqlDevise::MountMethod::OptionValidators::SupportedOperationsValidator
- Defined in:
- lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
Instance Method Summary collapse
-
#initialize(provided_operations: [], supported_operations: [], key:) ⇒ SupportedOperationsValidator
constructor
A new instance of SupportedOperationsValidator.
- #validate! ⇒ Object
Constructor Details
#initialize(provided_operations: [], supported_operations: [], key:) ⇒ SupportedOperationsValidator
Returns a new instance of SupportedOperationsValidator.
7 8 9 10 11 |
# File 'lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb', line 7 def initialize(provided_operations: [], supported_operations: [], key:) @provided_operations = provided_operations @supported_operations = supported_operations @key = key end |
Instance Method Details
#validate! ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb', line 13 def validate! unsupported_operations = @provided_operations - @supported_operations if unsupported_operations.present? raise( InvalidMountOptionsError, "#{@key} option contains unsupported operations: \"#{unsupported_operations.join(', ')}\". Check for typos." ) end end |