For an object to be compliant with the handler API, it needs to respond to the call method. This method receives as an argument an instance of ActionView::Template, which we introduced in Writing the Code, and should return a string containing valid Ruby code. The Ruby code the handler returns is then compiled into a method, so rendering a template is as simple as invoking this compiled method.
Before diving into our Markdown + ERB handler, let’s create a few template handlers to get acquainted with the API.
Our first template handler simply allows arbitrary Ruby code as a template. This means the following template is valid:
body = ""
body << "This is my first "
body << ...