Sha256: 23be20bd7bb12784df2f133868032c0c0d369fc66ada33d792cf41cb7a9cae98

Contents?: true

Size: 795 Bytes

Versions: 18

Compression:

Stored size: 795 Bytes

Contents

# frozen_string_literal: true

module GraphqlDevise
  module MountMethod
    module OptionValidators
      class SupportedOperationsValidator
        def initialize(provided_operations: [], supported_operations: [], key:)
          @provided_operations  = provided_operations
          @supported_operations = supported_operations
          @key                  = key
        end

        def validate!
          unsupported_operations = @provided_operations - @supported_operations

          if unsupported_operations.present?
            raise(
              GraphqlDevise::InvalidMountOptionsError,
              "#{@key} option contains unsupported operations: \"#{unsupported_operations.join(', ')}\". Check for typos."
            )
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
graphql_devise-0.18.2 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.18.1 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.18.0 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.17.1 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.17.0 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.16.0 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.15.0 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.14.3 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.14.2 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.14.1 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.14.0 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.13.6 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.13.5 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.13.4 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.13.3 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.13.2 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.13.1 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb
graphql_devise-0.13.0 lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb