Sha256: e77b3e6e1a6bc690768c7171e88bb4ca7976d6c706b8a58a9047fc845f8ab233

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

require 'voom/presenters/dsl/user_interface'

module Voom
  module Presenters
    module DSL
      # 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
      class Definition
        def initialize(namespace, &block)
          @block = block
          @namespace = namespace
        end

        def build
          self
        end

        def expand(router: , context:{}, &block)
          presenter = UserInterface.new(router: router, context: context,  namespace: @namespace, &@block)
          yield(presenter) if block
          presenter.expand_instance
        end

        # Used by attach
        def expand_child(parent:, context: {})
          presenter = UserInterface.new(parent: parent, context: context, namespace: @namespace, &@block)
          presenter.expand_instance(freeze: false)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voom-presenters-0.2.0 lib/voom/presenters/dsl/definition.rb