Sha256: d961dc52c84477ab8f23160f425d5d1d8803f8b53373ef73460263c60f39e90a

Contents?: true

Size: 681 Bytes

Versions: 8

Compression:

Stored size: 681 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 "Created file! : #{file_path}"
        file_path
      rescue StandardError => e
        raise StandardError, e
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
souls-0.22.9 lib/souls/generate/connection.rb
souls-0.22.8 lib/souls/generate/connection.rb
souls-0.22.7 lib/souls/generate/connection.rb
souls-0.22.6 lib/souls/generate/connection.rb
souls-0.22.5 lib/souls/generate/connection.rb
souls-0.22.4 lib/souls/generate/connection.rb
souls-0.22.3 lib/souls/generate/connection.rb
souls-0.22.2 lib/souls/generate/connection.rb