crygen
crygen is a library that allows to generate a Crystal file. It is inspired by the PHP library : nette/php-generator.
- Crygen documentation: https://tamdaz.github.io/crygen/
 - API documentation: https://crystaldoc.info/github/tamdaz/crygen/main/index.html
 
Installation
- Add the dependency to your 
shard.yml: 
dependencies:
  crygen:
    github: tamdaz/crygen
    version: ~> 1.2.0
- 
Run
shards install - 
Finally, import
crygenfrom the entrypoint file: 
require "crygen"
module App
  VERSION = "1.0.0"
  class_type = CGT::Class.new("MyClass")
  method_type = CGT::Method.new("my_method", "String")
  class_type.add_method(method_type)
  puts class_type.generate
  # or
  puts class_type
  # Output:
  # class MyClass
  #   def my_method : String
  #   end
  # end
  # You can save the generated code into the .cr file.
  File.write("src/classes/my_class.cr", class_type)
end
Contributing
- Fork it (https://github.com/tamdaz/crygen/fork)
 - Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request