Imagine we need (for some reason) a helper that shuffles the characters of a string and we want it to be available in our views.
There is NO coupling between the file name and the name of the module. We can define this code where and how we want.
# apps/web/application.rb
module Web
class Application < Hanami::Application
configure do
'helpers',
'controllers',
'views'
]
# ...
view.prepare do
include Hanami::Helpers
include Web::Helpers::Shuffler
end
end
end
Please note that our custom helper will work even if we remove the include Hanami::Helpers
line, because it’s just Ruby.