lib/graphql/schema/subscription.rb in graphql-1.9.21 vs lib/graphql/schema/subscription.rb in graphql-1.10.0.pre1

- old
+ new

@@ -27,26 +27,26 @@ # The generated payload type is required; If there's no payload, # propagate null. null false - def initialize(object:, context:, field:) + def initialize(object:, context:) super # Figure out whether this is an update or an initial subscription @mode = context.query.subscription_update? ? :update : :subscribe end # Implement the {Resolve} API def resolve(**args) # Dispatch based on `@mode`, which will raise a `NoMethodError` if we ever # have an unexpected `@mode` - public_send("resolve_#{@mode}", **args) + public_send("resolve_#{@mode}", args) end # Wrap the user-defined `#subscribe` hook - def resolve_subscribe(**args) - ret_val = args.any? ? subscribe(**args) : subscribe + def resolve_subscribe(args) + ret_val = args.any? ? subscribe(args) : subscribe if ret_val == :no_response context.skip else ret_val end @@ -60,11 +60,11 @@ def subscribe(args = {}) :no_response end # Wrap the user-provided `#update` hook - def resolve_update(**args) - ret_val = args.any? ? update(**args) : update + def resolve_update(args) + ret_val = args.any? ? update(args) : update if ret_val == :no_update raise NoUpdateError else ret_val end