Sha256: 4473019766187922627e1929ad304a5b94c67a0ab65b235acb17e243189bbab9

Contents?: true

Size: 815 Bytes

Versions: 17

Compression:

Stored size: 815 Bytes

Contents

module Souls
  module Api::Generate
    def self.connection(class_name: "user")
      file_dir = "./app/graphql/types/connections/"
      FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
      singularized_class_name = class_name.underscore.singularize
      file_path = "./app/graphql/types/connections/#{singularized_class_name}_connection.rb"
      File.open(file_path, "w") do |f|
        f.write(<<~TEXT)
          class Types::#{singularized_class_name.camelize}Connection < Types::BaseConnection
            edge_type(Types::#{singularized_class_name.camelize}Edge)
          end
        TEXT
      end
      puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
      file_path
    rescue StandardError => e
      raise(StandardError, e)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
souls-0.51.2 lib/souls/api/generate/connection.rb
souls-0.51.1 lib/souls/api/generate/connection.rb
souls-0.51.0 lib/souls/api/generate/connection.rb
souls-0.50.0 lib/souls/api/generate/connection.rb
souls-0.49.0 lib/souls/api/generate/connection.rb
souls-0.48.2 lib/souls/api/generate/connection.rb
souls-0.48.1 lib/souls/api/generate/connection.rb
souls-0.48.0 lib/souls/api/generate/connection.rb
souls-0.47.1 lib/souls/api/generate/connection.rb
souls-0.47.0 lib/souls/api/generate/connection.rb
souls-0.46.1 lib/souls/api/generate/connection.rb
souls-0.46.0 lib/souls/api/generate/connection.rb
souls-0.45.4 lib/souls/api/generate/connection.rb
souls-0.45.3 lib/souls/api/generate/connection.rb
souls-0.45.2 lib/souls/api/generate/connection.rb
souls-0.45.1 lib/souls/api/generate/connection.rb
souls-0.45.0 lib/souls/api/generate/connection.rb