Class: Hanami::View::Rendering::NullLayout Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/view/rendering/null_layout.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.

Null Object pattern for Layout. It’s used when a view doesn’t require a layout.

Examples:

require 'hanami/view'

module Articles
  class Show
    include Hanami::View
    layout false
  end
end

# In this scenario we will use a `NullLayout`.

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(scope, rendered) ⇒ NullLayout

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.

Initialize a layout

Parameters:

See Also:

Since:

  • 0.1.0



33
34
35
# File 'lib/hanami/view/rendering/null_layout.rb', line 33

def initialize(scope, rendered)
  @rendered = rendered
end

Instance Method Details

#renderString

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.

Render the layout

Returns:

  • (String)

    the output of the rendering process

See Also:

Since:

  • 0.1.0



46
47
48
# File 'lib/hanami/view/rendering/null_layout.rb', line 46

def render
  @rendered
end