Class: GraphQL::Schema::Printer::TypeKindPrinters::EnumPrinter

Inherits:
Object
  • Object
show all
Extended by:
DeprecatedPrinter, DescriptionPrinter
Defined in:
lib/graphql/schema/printer.rb

Class Method Summary collapse

Methods included from DeprecatedPrinter

print_deprecated

Methods included from DescriptionPrinter

print_description

Class Method Details



227
228
229
230
231
232
233
234
235
# File 'lib/graphql/schema/printer.rb', line 227

def self.print(type)
  values = type.values.values.map{ |v| "  #{v.name}#{print_deprecated(v)}" }.join("\n")
  values = type.values.values.map.with_index { |v, i|
    "#{print_description(v, '  ', i == 0)}"\
    "  #{v.name}#{print_deprecated(v)}"
  }.join("\n")
  "#{print_description(type)}"\
  "enum #{type.name} {\n#{values}\n}"
end