class Voom::Presenters::DSL::Definition

The default dsl for ui This class is held in the container. When a request to render a UI comes in It creates a new UserInterface instance, binding it to the router and context of the request

Attributes

name[R]
namespace[R]
options[R]

Public Class Methods

new(name, namespace, options, &block) click to toggle source
# File lib/voom/presenters/dsl/definition.rb, line 9
def initialize(name, namespace, options, &block)
  @block = block
  @name = name
  @namespace = namespace
  @options = options
end

Public Instance Methods

build() click to toggle source
# File lib/voom/presenters/dsl/definition.rb, line 16
def build
  self
end
expand(router: , context:{}) { |presenter| ... } click to toggle source
# File lib/voom/presenters/dsl/definition.rb, line 20
def expand(router: , context:{}, &block)
  presenter = UserInterface.new(router: router, context: context,  name: @name, namespace: @namespace, &@block)
  yield(presenter) if block
  presenter.expand_instance
end
expand_child(parent:, context: {}) click to toggle source

Used by attach

# File lib/voom/presenters/dsl/definition.rb, line 27
def expand_child(parent:, context: {})
  presenter = UserInterface.new(parent: parent, context: context, namespace: @namespace, &@block)
  presenter.expand_instance(freeze: false)
end