Sha256: 8fb314e97c62d71425d8c70fd073d86c54d68741d4e614e106e778183ce8a68b
Contents?: true
Size: 885 Bytes
Versions: 11
Compression:
Stored size: 885 Bytes
Contents
# frozen_string_literal: true module GraphqlDevise module MountMethod module OperationPreparers class CustomOperationPreparer def initialize(selected_keys:, custom_operations:, mapping_name:) @selected_keys = selected_keys @custom_operations = custom_operations @mapping_name = mapping_name end def call @custom_operations.slice(*@selected_keys).each_with_object({}) do |(action, operation), result| mapped_action = "#{@mapping_name}_#{action}" result[mapped_action.to_sym] = [ OperationPreparers::GqlNameSetter.new(mapped_action), OperationPreparers::ResourceNameSetter.new(@mapping_name) ].reduce(operation) { |prepared_operation, preparer| preparer.call(prepared_operation) } end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems