Try Phlex Ruby

Change the Ruby code below, defining any Phlex::HTML component, to see it re-rendered.

class Card < Phlex::HTML
  attr_writer :title, :body

  def initialize(title: 'Card Title', body: 'Card Body')
    @title = title
    @body = body
  end

  def view_template
    div(id: 'card') do
      h2 { @title }
      p { @body }
    end
  end
end