Sha256: 699cb2852c4144781015aa6a75da8cda2d26f6689ae7d4838b57cec1522ad9e8

Contents?: true

Size: 754 Bytes

Versions: 5

Compression:

Stored size: 754 Bytes

Contents

# frozen_string_literal: true

module Rails
  module GraphQL
    # = GraphQL Base Generator
    #
    # A module to help generators to operate
    module BaseGenerator
      TEMPALTES_PATH = '../../../generators/graphql/templates'
      APP_MODULE_NAME = Rails.application.class.name.chomp('::Application')

      def self.included(base)
        base.const_set(:APP_MODULE_NAME, APP_MODULE_NAME)
        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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-graphql-1.0.2 lib/rails/graphql/railties/base_generator.rb
rails-graphql-1.0.1 lib/rails/graphql/railties/base_generator.rb
rails-graphql-1.0.0 lib/rails/graphql/railties/base_generator.rb
rails-graphql-1.0.0.rc2 lib/rails/graphql/railties/base_generator.rb
rails-graphql-1.0.0.rc1 lib/rails/graphql/railties/base_generator.rb