class Graphql::Generators::EnumGenerator

Generate an enum type by name, with the given values. To add a `value:` option, add another value after a `:`.

“` rails g graphql:enum ProgrammingLanguage RUBY PYTHON PERL PERL6:“PERL” “`

Public Instance Methods

create_type_file() click to toggle source
# File lib/generators/graphql/enum_generator.rb, line 21
def create_type_file
  template "enum.erb", "#{options[:directory]}/types/#{type_file_name}.rb"
end

Private Instance Methods

prepared_values() click to toggle source
# File lib/generators/graphql/enum_generator.rb, line 27
def prepared_values
  values.map { |v| v.split(":", 2) }
end