Sha256: cf1e3ed5ed6ad97c4a01ae23d4ecf4a7364fc17361b9ce754d2548c784ef9ec7
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
module Souls module Worker module Generate class << self def mutation(class_name: "csv_export") file_dir = "./app/graphql/mutations/" FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir) file_path = "#{file_dir}#{class_name.singularize}_job.rb" raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path) File.open(file_path, "w") do |f| f.write(<<~TEXT) module Mutations class #{class_name.camelize}Job < BaseMutation description "Job Description" field :response, String, null: false def resolve # Define Job Here { response: "Job queued!" } rescue StandardError => e GraphQL::ExecutionError.new(e.to_s) end end end TEXT end puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }]) file_path end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
souls-0.33.5 | lib/souls/worker/generate/mutation.rb |
souls-0.33.4 | lib/souls/worker/generate/mutation.rb |
souls-0.33.3 | lib/souls/worker/generate/mutation.rb |