lib/rails/graphql/callback.rb
# Read the arguments needed for a block then collect them from the
# event and return the execution args
Read the arguments needed for a block then collect them from the
event and return the execution args
Read the arguments needed for a block then collect them from the event and return the execution args
def collect_parameters(event, send_args, block = @block)
          args_source = event.send(:args_source)
          send_args[0] += @pre_args.deep_dup
          send_args[1].merge!(@pre_xargs.deep_dup)
          return send_args unless inject_arguments?
          idx = -1
          block.parameters.each_with_object(send_args) do |(type, name), result|
            case type
            when :opt, :req
              idx += 1
              next unless callback_inject_arguments
              result[0][idx] ||= event.parameter(name) if event.parameter?(name)
            when :keyreq
              next unless callback_inject_named_arguments
              result[1][name] ||= args_source[name]
            when :key
              next unless callback_inject_named_arguments
              result[1][name] ||= args_source[name] if args_source.key?(name)
            end
          end
        end
def collect_parameters ( event , send_args , block = @block ) args_source = event . send ( :args_source ) send_args [ 0 ] += @pre_args . deep_dup send_args [ 1 ] . merge! ( @pre_xargs . deep_dup ) return send_args unless inject_arguments? idx = - 1 block . parameters . each_with_object ( send_args ) do | ( type , name ) , result | case type when :opt , :req idx += 1 next unless callback_inject_arguments result [ 0 ] [ idx ] ||= event . parameter ( name ) if event . parameter? ( name ) when :keyreq next unless callback_inject_named_arguments result [ 1 ] [ name ] ||= args_source [ name ] when :key next unless callback_inject_named_arguments result [ 1 ] [ name ] ||= args_source [ name ] if args_source . key? ( name ) end end end
Read the arguments needed for a block then collect them from the
event and return the execution args
Read the arguments needed for a block then collect them from the event and return the execution args
# TODO: Maybe we need to turn procs into lambdas so the optional # arguments doesn't suffer any kind of change
event
send_args
block