Sha256: 9f4a61388c780c2657653e99a5026dedc349660aa3d16f65f6bb8d5a9049f11c
Contents?: true
Size: 1001 Bytes
Versions: 6
Compression:
Stored size: 1001 Bytes
Contents
# frozen_string_literal: true module Rails # :nodoc: module GraphQL # :nodoc: # = GraphQL Base Generator # # A module to help generators to operate module BaseGenerator TEMPALTES_PATH = '../../../generators/graphql/templates' def self.included(base) base.send(:namespace, "graphql:#{base.name.demodulize.underscore[0..-11]}") base.send(:source_root, File.expand_path(TEMPALTES_PATH, __dir__)) base.send(:class_option, :directory, type: :string, default: 'app/graphql', desc: 'Directory where generated files should be saved', ) end protected def app_module_name require File.expand_path('config/application', destination_root) app_class = Rails.application.class source_name = app_class.respond_to?(:module_parent_name) \ ? :module_parent_name \ : :parent_name app_class.send(source_name) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems