Module: Cannon::Views

Includes:
PathCache
Included in:
Response
Defined in:
lib/cannon/views.rb

Instance Method Summary collapse

Methods included from PathCache

included

Instance Method Details

#view(filename, options = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/cannon/views.rb', line 7

def view(filename, options = {})
  reload_cache if outdated_cache?

  file, content_type = *file_and_content_type("#{base_path}/#{filename}")
  header('Content-Type', content_type)
  send(Mustache.render(file, options), status: status)
end