Sha256: 4a476b03c5f68cae59753f5fa622bbadba994dabe03eb73e10ea8d6beb3dad4e
Contents?: true
Size: 811 Bytes
Versions: 42
Compression:
Stored size: 811 Bytes
Contents
module Souls module Generate def self.connection(class_name: "souls") 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
42 entries across 42 versions & 1 rubygems