Class: Hibana::View

Inherits:
Object
  • Object
show all
Defined in:
lib/hibana/view.rb

Instance Method Summary collapse

Constructor Details

#initialize(layout_template_path: nil, partial_template_path:, request:) ⇒ View

Returns a new instance of View.

Parameters:

  • layout_template_path (String, nil) (defaults to: nil)
  • partial_template_path (String)
  • request (Rack::Request)


8
9
10
11
12
# File 'lib/hibana/view.rb', line 8

def initialize(layout_template_path: nil, partial_template_path:, request:)
  @layout_template_path = layout_template_path
  @partial_template_path = partial_template_path
  @request = request
end

Instance Method Details

#to_sString

Returns:

  • (String)


15
16
17
18
19
20
21
22
23
# File 'lib/hibana/view.rb', line 15

def to_s
  if @layout_template_path
    render_layout do
      render_partial
    end
  else
    render_partial
  end
end