Phlex views are “plain old Ruby objects” — templates are methods and HTML tags are method calls. If you know how to define a class with a method that calls another method, you know how to use Phlex.

When it comes to API usability, Ruby is so tough to beat. This looks actually fun to use!

class Nav < Phlex::HTML def template nav(class: "main-nav") { ul { li { a(href: "/") { "Home" } } li { a(href: "/about") { "About" } } li { a(href: "/contact") { "Contact" } } } } endend Discuss on Changelog News