Sha256: 09187be7c3e13992af66f77f93e77d6d637a61e32a3f11cb11f32111a2e71741

Contents?: true

Size: 633 Bytes

Versions: 7

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

module GraphqlDevise
  module MountMethod
    class OperationSanitizer
      def self.call(default:, only:, skipped:)
        new(
          default: default,
          only:    only,
          skipped: skipped
        ).call
      end

      def initialize(default:, only:, skipped:)
        @default = default
        @only    = only
        @skipped = skipped
      end

      def call
        operations = if @only.present?
          @default.slice(*@only)
        elsif @skipped.present?
          @default.except(*@skipped)
        else
          @default
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
graphql_devise-1.4.0 lib/graphql_devise/mount_method/operation_sanitizer.rb
graphql_devise-1.3.0 lib/graphql_devise/mount_method/operation_sanitizer.rb
graphql_devise-1.2.0 lib/graphql_devise/mount_method/operation_sanitizer.rb
graphql_devise-1.1.1 lib/graphql_devise/mount_method/operation_sanitizer.rb
graphql_devise-1.1.0 lib/graphql_devise/mount_method/operation_sanitizer.rb
graphql_devise-1.0.1 lib/graphql_devise/mount_method/operation_sanitizer.rb
graphql_devise-1.0.0 lib/graphql_devise/mount_method/operation_sanitizer.rb