Sha256: 75faa74b53b8212cba77aa924f2f85404544910c9640c3f8b87e4804ef9f42e6

Contents?: true

Size: 895 Bytes

Versions: 7

Compression:

Stored size: 895 Bytes

Contents

# frozen_string_literal: true
require "graphql/language/block_string"
require "graphql/language/printer"
require "graphql/language/document_from_schema_definition"
require "graphql/language/generation"
require "graphql/language/lexer"
require "graphql/language/nodes"
require "graphql/language/parser"
require "graphql/language/token"
require "graphql/language/visitor"
require "graphql/language/definition_slice"

module GraphQL
  module Language
    # @api private
    def self.serialize(value)
      if value.is_a?(Hash)
        serialized_hash = value.map do |k, v|
          "#{k}:#{serialize v}"
        end.join(",")

        "{#{serialized_hash}}"
      elsif value.is_a?(Array)
        serialized_array = value.map do |v|
          serialize v
        end.join(",")

        "[#{serialized_array}]"
      else
        JSON.generate(value, quirks_mode: true)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
graphql-1.10.3 lib/graphql/language.rb
graphql-1.10.2 lib/graphql/language.rb
graphql-1.10.1 lib/graphql/language.rb
graphql-1.10.0 lib/graphql/language.rb
graphql-1.10.0.pre4 lib/graphql/language.rb
graphql-1.10.0.pre3 lib/graphql/language.rb
graphql-1.10.0.pre2 lib/graphql/language.rb