Sha256: 26667d3ff4e31cbed2c7a84f73da4343ada70e708427ca4c37d62990dc097021

Contents?: true

Size: 742 Bytes

Versions: 6

Compression:

Stored size: 742 Bytes

Contents

module Souls
  module Generate
    class << self
      def connection class_name: "souls"
        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 <<~EOS
            class Types::#{singularized_class_name.camelize}Connection < Types::BaseConnection
              edge_type(Types::#{singularized_class_name.camelize}Edge)
            end
          EOS
        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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
souls-0.23.5 lib/souls/generate/connection.rb
souls-0.23.4 lib/souls/generate/connection.rb
souls-0.23.3 lib/souls/generate/connection.rb
souls-0.23.2 lib/souls/generate/connection.rb
souls-0.23.1 lib/souls/generate/connection.rb
souls-0.23.0 lib/souls/generate/connection.rb