30 lines
566 B
Ruby
30 lines
566 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "hotch"
|
|
require "pathname"
|
|
require "ostruct"
|
|
require "hanami/view"
|
|
|
|
TEMPLATES_PATHS = Pathname(__FILE__).dirname.join("templates")
|
|
|
|
TEMPLATE_LOCALS = {
|
|
users: [
|
|
OpenStruct.new(name: "Jane", email: "Jane@example.com"),
|
|
OpenStruct.new(name: "Teresa", email: "teresa@example.com")
|
|
]
|
|
}.freeze
|
|
|
|
class View < Hanami::View
|
|
config.paths = TEMPLATES_PATHS
|
|
config.layout = "app"
|
|
config.template = "users"
|
|
|
|
expose :users
|
|
end
|
|
|
|
view = View.new
|
|
|
|
Hotch(filter: /View/) do
|
|
100.times { view.(**TEMPLATE_LOCALS).to_s }
|
|
end
|