Keynote

screenshot of Keynote

Flexible presenters for Rails.

Overview

Keynote is an innovative gem designed for Ruby on Rails that showcases the power of presenters. By encapsulating view logic within objects, presenters help streamline templates and maintain clean code. This allows developers to focus on the presentation layer without getting bogged down by complex logic. With its simple yet effective interface, Keynote empowers developers to create clean, manageable code that enhances the development process.

This gem is tailored for those working with Ruby 3.0.0 and Rails 7.0 or newer, making it a perfect fit for modern applications. It promotes a structured way to generate HTML and manage view-related logic, making it an essential tool for developers looking to simplify their codebase while enhancing maintainability.

Features

  • Encapsulated View Logic: Keynote allows you to bundle view logic into presenter objects, keeping your templates clean and straightforward.

  • Easy Instantiation: Presenters can be instantiated through a simple present method or its alias k, streamlining the presenter usage process.

  • HTML Generation Made Simple: With the integrated build_html method, generating complex HTML fragments becomes intuitive and straightforward, utilizing a block-based syntax.

  • Inline Templating Support: Extend your presenter with the Keynote::Inline module for inline templating in any Rails-supported template language, perfect for small components.

  • Delegation Support: Quickly delegate method calls to underlying objects using ActiveSupport's delegate API for cleaner and more readable code.

  • Testing Made Easy: Keynote presenters are easily testable with popular frameworks like RSpec and MiniTest, ensuring that your view logic is both functional and reliable.

  • Organized Structure: Organizes presenter tests in a dedicated folder (spec/presenters), encouraging structured code and efficient testing practices.