Module: Hanami::Layout::ClassMethods

Defined in:
lib/hanami/layout.rb

Overview

Class level API

Since:

  • 0.1.0

Constant Summary collapse

SUFFIX =

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

Template name suffix

See Also:

Since:

  • 0.1.0

'_layout'.freeze

Instance Method Summary collapse

Instance Method Details

#registryObject

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.

A registry that holds all the registered layouts.

See Also:

Since:

  • 0.1.0



61
62
63
# File 'lib/hanami/layout.rb', line 61

def registry
  @registry ||= View::Rendering::LayoutRegistry.new(self)
end

#suffixObject

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.

Template name suffix

See Also:

Since:

  • 0.1.0



92
93
94
# File 'lib/hanami/layout.rb', line 92

def suffix
  SUFFIX
end

#templateObject

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.

Template name

ApplicationLayout.template # => ‘application’

Examples:

# Given a template 'templates/application.html.erb'

class ApplicationLayout
  include Hanami::Layout
end

See Also:

Since:

  • 0.1.0



81
82
83
# File 'lib/hanami/layout.rb', line 81

def template
  super.sub(suffix, '')
end