Class: Graphql::Generators::OrmMutationsBase
- Inherits:
 - 
      Rails::Generators::NamedBase
      
        
- Object
 - Rails::Generators::NamedBase
 - Graphql::Generators::OrmMutationsBase
 
 
- Includes:
 - Core, Rails::Generators::ResourceHelpers
 
- Defined in:
 - lib/generators/graphql/orm_mutations_base.rb
 
Overview
TODO: What other options should be supported?
Direct Known Subclasses
MutationCreateGenerator, MutationDeleteGenerator, MutationUpdateGenerator
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
      28 29 30 31 32 33 34 35 36 37  | 
    
      # File 'lib/generators/graphql/orm_mutations_base.rb', line 28 def create_mutation_file template "mutation_#{operation_type}.erb", File.join([:directory], "/mutations/", class_path, "#{file_name}_#{operation_type}.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}_#{operation_type}, mutation: Mutations::#{class_name}#{operation_type.classify}\n", after: sentinel, verbose: false, force: false end end  |