Module: Hanami::Extensions::View::Part

Defined in:
lib/hanami/extensions/view/part.rb

Overview

Since:

  • 2.1.0

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(part_class) ⇒ 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:

  • 2.1.0



11
12
13
14
15
16
# File 'lib/hanami/extensions/view/part.rb', line 11

def self.included(part_class)
  super

  part_class.extend(Hanami::SliceConfigurable)
  part_class.extend(ClassMethods)
end

Instance Method Details

#helpersObject

Returns an object including the default Hanami helpers as well as the user-defined helpers for the part’s slice.

Use this when you need to access helpers inside your part classes.

Returns:

  • (Object)

    the helpers object

Since:

  • 2.1.0



41
42
43
# File 'lib/hanami/extensions/view/part.rb', line 41

def helpers
  @helpers ||= self.class.const_get(:PartHelpers).new(context: _context)
end