v1.2.0
Constructor helper method.
With the v1.2.0 Crygen's release, you can easily add the constructor by calling
the #add_initialize helper method.
Crygen::Types::Class.new("Person").add_initialize do |method|
method.add_arg("@x", "Int32")
method.add_arg("@y", "Int32")
end
With the example code above, it is possible to configure the method for adding the arguments and write the body. The block is not required for adding the constructor.
Generate nested classes and structs
Also, this version provides the new feature for adding the class in the class or the struct in the struct.
Output:
Output:
Warning
For the moment, it is not possible to add a struct in a class and vice versa. If you need this feature for your project, don't hesitate to create an issue on Github.