Class: Hanami::View::Rendering::Subscope Private

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

Rendering subscope

See Also:

Since:

  • 1.1.1

Instance Method Summary collapse

Methods inherited from Scope

#format, #initialize, #inspect

Methods inherited from LayoutScope

#class, #format, #initialize, #inspect, #local, #locals, #render, #respond_to?, #view

Constructor Details

This class inherits a constructor from Hanami::View::Rendering::Scope

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object (protected)

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:

  • 1.1.1



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/hanami/view/rendering/subscope.rb', line 32

def method_missing(m, *args, &block)
  ::Hanami::View::Escape.html(
    # FIXME: this isn't compatible with Hanami 2.0, as it extends a view
    # that we want to be frozen in the future
    #
    # See https://github.com/hanami/view/issues/130#issuecomment-319326236
    if @locals.key?(m)
      @locals[m]
    else
      super
    end
  )
end

Instance Method Details

#respond_to_missing?(m, _include_all) ⇒ TrueClass, FalseClass

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.

Implements “respond to” logic

Returns:

  • (TrueClass, FalseClass)

See Also:

Since:

  • 1.1.1



24
25
26
# File 'lib/hanami/view/rendering/subscope.rb', line 24

def respond_to_missing?(m, _include_all)
  @locals.key?(m)
end