Module: Hanami::Layout

Defined in:
gems/gems/hanami-view-1.3.0/lib/hanami/layout.rb

Overview

Layout

See Also:

Since:

  • 0.1.0

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#local(key) ⇒ Object, Hanami::View::Rendering::NullLocal

It tries to invoke a method for the view or a local for the given key. If the lookup fails, it returns a null object.

Examples:

Safe method navigation

class ApplicationLayout
  include Hanami::Layout

  def render_flash
    return if local(:flash).nil?

    # ...
  end
end

Returns:

Since:

  • 1.1.0

def local(key)
  @scope.local(key)
end