Class: Graphql::Generators::MutationGenerator
- Inherits:
 - 
      Rails::Generators::NamedBase
      
        
- Object
 - Rails::Generators::NamedBase
 - Graphql::Generators::MutationGenerator
 
 
- Includes:
 - Core
 
- Defined in:
 - lib/generators/graphql/mutation_generator.rb
 
Overview
TODO: What other options should be supported?
Instance Method Summary collapse
Methods included from Core
#create_dir, #insert_root_type, #module_namespacing_when_supported, #schema_file_path
Instance Method Details
#create_mutation_file ⇒ Object
      18 19 20 21 22 23 24 25 26 27  | 
    
      # File 'lib/generators/graphql/mutation_generator.rb', line 18 def create_mutation_file template "mutation.erb", File.join([:directory], "/mutations/", class_path, "#{file_name}.rb") sentinel = /class .*MutationType\s*<\s*[^\s]+?\n/m in_root do path = "#{[:directory]}/types/mutation_type.rb" invoke "graphql:install:mutation_root" unless File.exist?(path) inject_into_file "#{[:directory]}/types/mutation_type.rb", " field :#{file_name}, mutation: Mutations::#{class_name}\n", after: sentinel, verbose: false, force: false end end  |