Module: GraphQL::Language
- Defined in:
- lib/graphql/language.rb,
lib/graphql/language/lexer.rb,
lib/graphql/language/nodes.rb,
lib/graphql/language/token.rb,
lib/graphql/language/parser.rb,
lib/graphql/language/printer.rb,
lib/graphql/language/visitor.rb,
lib/graphql/language/comments.rb,
lib/graphql/language/generation.rb,
lib/graphql/language/block_string.rb,
lib/graphql/language/definition_slice.rb,
lib/graphql/language/document_from_schema_definition.rb
Defined Under Namespace
Modules: BlockString, Comments, DefinitionSlice, Generation, Lexer, Nodes Classes: DocumentFromSchemaDefinition, Parser, Printer, Token, Visitor
Class Method Summary collapse
- .serialize(value) ⇒ Object private
Class Method Details
.serialize(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/graphql/language.rb', line 17 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 |