Sha256: c64772e38cdc10278235ece64a1372876de142dc7c187cce5c88da7e69d0d466

Contents?: true

Size: 774 Bytes

Versions: 42

Compression:

Stored size: 774 Bytes

Contents

module Souls
  module Generate
    def self.edge(class_name: "souls")
      file_dir = "./app/graphql/types/edges"
      FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
      singularized_class_name = class_name.underscore.singularize
      file_path = "./app/graphql/types/edges/#{singularized_class_name}_edge.rb"
      File.open(file_path, "w") do |f|
        f.write(<<~TEXT)
          class Types::#{singularized_class_name.camelize}Edge < Types::BaseEdge
            node_type(Types::#{singularized_class_name.camelize}Type)
          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

Version Path
souls-0.28.12 lib/souls/generate/edge.rb
souls-0.28.11 lib/souls/generate/edge.rb
souls-0.28.10 lib/souls/generate/edge.rb
souls-0.28.9 lib/souls/generate/edge.rb
souls-0.28.8 lib/souls/generate/edge.rb
souls-0.28.7 lib/souls/generate/edge.rb
souls-0.28.6 lib/souls/generate/edge.rb
souls-0.28.5 lib/souls/generate/edge.rb
souls-0.28.4 lib/souls/generate/edge.rb
souls-0.28.3 lib/souls/generate/edge.rb
souls-0.28.2 lib/souls/generate/edge.rb
souls-0.28.1 lib/souls/generate/edge.rb
souls-0.28.0 lib/souls/generate/edge.rb
souls-0.27.8 lib/souls/generate/edge.rb
souls-0.27.7 lib/souls/generate/edge.rb
souls-0.27.6 lib/souls/generate/edge.rb
souls-0.27.5 lib/souls/generate/edge.rb
souls-0.27.4 lib/souls/generate/edge.rb
souls-0.27.3 lib/souls/generate/edge.rb
souls-0.27.2 lib/souls/generate/edge.rb