maetl / calyx

A Ruby library for generating text with recursive template grammars.
MIT License
62 stars 5 forks source link

Split up codebase into class-per-file structure #10

Closed maetl closed 8 years ago

maetl commented 8 years ago

The original implementation of Calyx was a single Ruby file with zero dependencies. While this concise and minimalist format made sense initially, Calyx has grown slightly larger than was forseen at that point in time. Splitting up the library into a standard format will hopefully help make things more maintainable and make the source code easier to understand.

There are several other restructurings which might be beneficial as a continuation of this. Firstly, nesting the AST node classes inside the grammar class seems unnecessary—a top level module is probably good enough here. Secondly (and perhaps less obviously), some of the parsing and factory methods could potentially be extracted out of the classmethods on AST nodes and into a more specialised template parsing module. Thirdly, adding new features and extensions will become easier when there is a consistent module and directory structure to follow.

maetl commented 8 years ago

FYI @tra38. I’m going to bring in these changes in the next couple of days.

tra38 commented 8 years ago

That'll be fine. I'll wait until this gets merged in before I send my pull request for JSON/YAML support.