Class: GraphQL::Language::Printer
- Inherits:
-
Object
- Object
- GraphQL::Language::Printer
- Defined in:
- lib/graphql/language/printer.rb
Direct Known Subclasses
SanitizedPrinter, Schema::Printer, Schema::Printer::IntrospectionPrinter
Defined Under Namespace
Classes: TruncatableBuffer
Constant Summary collapse
- OMISSION =
"... (truncated)"
Instance Method Summary collapse
-
#print(node, indent: "", truncate_size: nil) ⇒ String
Turn an arbitrary AST node back into a string.
Instance Method Details
#print(node, indent: "", truncate_size: nil) ⇒ String
Turn an arbitrary AST node back into a string.
54 55 56 57 58 59 60 61 |
# File 'lib/graphql/language/printer.rb', line 54 def print(node, indent: "", truncate_size: nil) truncate_size = truncate_size ? [truncate_size - OMISSION.size, 0].max : nil @out = TruncatableBuffer.new(truncate_size: truncate_size) print_node(node, indent: indent) @out.to_string rescue TruncatableBuffer::TruncateSizeReached @out.to_string << OMISSION end |