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 DescriptionPrinter

print_description

Methods included from DeprecatedPrinter

print_deprecated

Class Method Details


234
235
236
237
238
239
240
241
242
# File 'lib/graphql/schema/printer.rb', line 234

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