Class: Hanami::View::ScopeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/view/scope_builder.rb

Overview

Builds scope objects via matching classes

Since:

  • 2.1.0

Class Method Summary collapse

Class Method Details

.call(name = nil, locals:, rendering:) ⇒ Hanami::View::Scope

Returns a new scope using a class matching the name.

Parameters:

  • name (Symbol, Class) (defaults to: nil)

    scope name

  • locals (Hash<Symbol, Object>)

    locals hash

Returns:

Since:

  • 2.1.0



20
21
22
23
24
# File 'lib/hanami/view/scope_builder.rb', line 20

def call(name = nil, locals:, rendering:) # rubocop:disable Style/OptionalArguments
  klass = scope_class(name, rendering: rendering)

  klass.new(name: name, locals: locals, rendering: rendering)
end