Skip to content

Commit d1e02f7

Browse files
author
Jake Boxer
committed
Reload view registry on each request
1 parent 35ef604 commit d1e02f7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/hyperloop/application.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ class Application
77
include Rack::Utils
88

99
def initialize(root=nil)
10-
@root = root
11-
@view_registry = View::Registry.new(@root)
10+
@root = root
1211
end
1312

1413
# Rack call interface.
1514
def call(env)
16-
request = Rack::Request.new(env)
17-
response = Response.new
15+
view_registry = View::Registry.new(@root)
16+
request = Rack::Request.new(env)
17+
response = Response.new
1818

1919
if self.class.asset_path?(request.path) && asset = assets[normalized_asset_path(request.path)]
2020
# If the path is for an asset, find the specified asset and use its data
2121
# as the response body.
2222
response["Content-Type"] = asset.content_type
2323
response.write(asset.source)
24-
elsif view = @view_registry.find_template_view(normalized_request_path(request.path))
24+
elsif view = view_registry.find_template_view(normalized_request_path(request.path))
2525
# If there's a view at the path, use its data as the response body.
2626
data = view.render(request)
2727
response.write(data)

0 commit comments

Comments
 (0)