0

Here's a definition of types and methods

short version

   {
      "name": "Abi",
      "type": "EnumOfTypes",
      "enum_types": [
        {
          "name": "Contract",
          "type": "Struct",
          "struct_fields": [
            {
              "name": "value",
              "type": "Ref",
              "ref_name": "abi.AbiContract",
              "summary": null,
              "description": null
            }
          ],
          "summary": null,
          "description": null
        },
        {
          "name": "Json",
          "type": "Struct",
          "struct_fields": [
            {
              "name": "value",
              "type": "String",
              "summary": null,
              "description": null
            }
          ],
          "summary": null,
          "description": null
        },

pastebin:

https://pastebin.com/AinPPgrb

The JSON document changes frequently. At the moment Ruby classes, types, methods... are written by hand and updated by hand too.

I've tried 1-2 Ruby code generators and they haven't worked. Is there a decent Ruby code generator out there that will be capable to work with this document and that'll generate code that's efficient and simple enough? Code should be without any additional dependencies or complicated unnecessary classes, structs...

Or how, in a nutshell, could I write a simple generator myself? The difficulty is that Ruby is dynamically types language.

michika
  • 11
  • 2
  • Consider adding details of the generators you have all ready tried, their outputs and your expected output. – User1010 Feb 10 '21 at 19:55
  • @User1010 consider adding arguments as of why I should consider that. – michika Feb 10 '21 at 20:19
  • Whilst not essential providing your existing attempts will aid with the answering of your question as this will allow the community to suggest improvements to these attempts based as well as new ideas. Providing your expected output allows the community to understand exactly what you are looking for reducing guesswork when answering. – User1010 Feb 10 '21 at 20:22
  • @User1010 please provide us the source of your claims – michika Feb 11 '21 at 06:40
  • As I say whilst not necessary it can't do any harm, https://stackoverflow.com/a/28481250/8458712 – User1010 Feb 11 '21 at 07:57
  • @User1010 how about the rule that one may not force others to do what one wants? – michika Feb 11 '21 at 15:42
  • I don't understand what you want to do with that JSON, Ruby classes ? Please provide the Ruby code "written by hand" for this example. – Fravadona Mar 29 '21 at 10:31

0 Answers0