Sha256: 43332cbbd0c9097774185187ea067a14f61a7169647cbb58a428dfae8a05e2a4

Contents?: true

Size: 508 Bytes

Versions: 3

Compression:

Stored size: 508 Bytes

Contents

# frozen_string_literal: true

module GQLi
  # Subscription node
  class Subscription < Base
    # Serializes to a GraphQL string
    def to_gql
      result = <<~GQL
        subscription #{__name ? __name + ' ' : ''}{
        #{__nodes.map(&:to_gql).join("\n")}
        }
      GQL

      result.lstrip
    end

    # Delegates itself to the client to be executed
    def __execute(client)
      client.execute(self)
    end

    # Serializes to a GraphQL string
    def to_s
      to_gql
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gqli-1.2.0 lib/gqli/subscription.rb
gqli-1.1.0 lib/gqli/subscription.rb
gqli-1.0.0 lib/gqli/subscription.rb