Sinatra FAQ seems to have a description
Sinatra: Frequently Asked Questions - How do I access helpers from within my views?
In hello.rb:
helpers do
defem(text)
"<em>#{text}</em>"
end
end
get'/hello'do
@subject='World'
haml —Hello
end
Views/hello.haml:
%p="Hello"+em(@subject)
© 2024 OneMinuteCode. All rights reserved.