Class: Voom::Presenters::DSL::Definition
- Inherits:
-
Object
- Object
- Voom::Presenters::DSL::Definition
- Defined in:
- lib/voom/presenters/dsl/definition.rb
Overview
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
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #build ⇒ Object
- #expand(router:, context: {}) {|presenter| ... } ⇒ Object
-
#expand_child(parent:, context: {}) ⇒ Object
Used by attach.
-
#initialize(name, namespace, options, &block) ⇒ Definition
constructor
A new instance of Definition.
Constructor Details
#initialize(name, namespace, options, &block) ⇒ Definition
Returns a new instance of Definition.
9 10 11 12 13 14 |
# File 'lib/voom/presenters/dsl/definition.rb', line 9 def initialize(name, namespace, , &block) @block = block @name = name @namespace = namespace @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/voom/presenters/dsl/definition.rb', line 8 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
8 9 10 |
# File 'lib/voom/presenters/dsl/definition.rb', line 8 def namespace @namespace end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/voom/presenters/dsl/definition.rb', line 8 def @options end |
Instance Method Details
#build ⇒ Object
16 17 18 |
# File 'lib/voom/presenters/dsl/definition.rb', line 16 def build self end |
#expand(router:, context: {}) {|presenter| ... } ⇒ Object
20 21 22 23 24 |
# File 'lib/voom/presenters/dsl/definition.rb', line 20 def (router: , context:{}, &block) presenter = UserInterface.new(router: router, context: context, name: @name, namespace: @namespace, &@block) yield(presenter) if block presenter. end |
#expand_child(parent:, context: {}) ⇒ Object
Used by attach
27 28 29 30 |
# File 'lib/voom/presenters/dsl/definition.rb', line 27 def (parent:, context: {}) presenter = UserInterface.new(parent: parent, context: context, namespace: @namespace, &@block) presenter.(freeze: false) end |