Class: Hanami::Views::Default Private

Inherits:
Object
  • Object
show all
Includes:
Hanami::View
Defined in:
lib/hanami/views/default.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The default view that is rendered for non successful responses (200 and 201)

Since:

  • 0.1.0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.render(root, template_name, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



25
26
27
28
29
30
31
32
33
34
# File 'lib/hanami/views/default.rb', line 25

def self.render(root, template_name, context)
  format   = context[:format]
  template = DefaultTemplateFinder.new(self, root, template_name, format).find

  if template
    new(template, context).render
  else
    super(context)
  end
end

Instance Method Details

#titleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



20
21
22
# File 'lib/hanami/views/default.rb', line 20

def title
  "#{response[0]} - #{response[2].first || Http::Status.message_for(response[0])}"
end