Class: Voom::Presenters::DSL::Components::Base
- Inherits:
-
Object
- Object
- Voom::Presenters::DSL::Components::Base
- Includes:
- LoggerMethods, Mixins::YieldTo, Lockable, Serializer, Trace
- Defined in:
- lib/voom/presenters/dsl/components/base.rb
Overview
Every object in the POM is a node This class provides common base implementation
Direct Known Subclasses
Action, Card::Actions, Card::Media, Dialog, Drawer, Event, EventBase, Footer, Grid, Header, List, Lists::Action, Lists::Separator, Menu, Menu::Divider, Page, Select::Option, Snackbar, Table, Table::Row, Tooltip
Instance Attribute Summary collapse
-
#attributes ⇒ Object
(also: #attribs)
readonly
Returns the value of attribute attributes.
-
#context ⇒ Object
(also: #params)
readonly
Returns the value of attribute context.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #expand! ⇒ Object
-
#initialize(type:, parent:, id: nil, context: {}, **attributes, &block) ⇒ Base
constructor
A new instance of Base.
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(type:, parent:, id: nil, context: {}, **attributes, &block) ⇒ Base
Returns a new instance of Base.
26 27 28 29 30 31 32 33 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 26 def initialize(type:, parent:, id: nil, context: {}, **attributes, &block) @id = h(id) || generate_id @type = h(type) @parent = parent @context = context @attributes = escape(attributes) @block = block end |
Instance Attribute Details
#attributes ⇒ Object (readonly) Also known as: attribs
Returns the value of attribute attributes.
21 22 23 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 21 def attributes @attributes end |
#context ⇒ Object (readonly) Also known as: params
Returns the value of attribute context.
21 22 23 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 21 def context @context end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
21 22 23 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 21 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
21 22 23 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 21 def type @type end |
Instance Method Details
#expand! ⇒ Object
35 36 37 38 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 35 def extend(_helpers_) if _helpers_ instance_eval(&@block) if @block end |