Class: Voom::Presenters::DSL::Components::Base
- Inherits:
-
Object
- Object
- Voom::Presenters::DSL::Components::Base
- Includes:
- LoggerMethods, 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 Serializer
Methods included from Lockable
Constructor Details
#initialize(type:, parent:, id: nil, context: {}, **attributes, &block) ⇒ Base
Returns a new instance of Base.
25 26 27 28 29 30 31 32 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 25 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.
20 21 22 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 20 def attributes @attributes end |
#context ⇒ Object (readonly) Also known as: params
Returns the value of attribute context.
20 21 22 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 20 def context @context end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20 21 22 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 20 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
20 21 22 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 20 def type @type end |
Instance Method Details
#expand! ⇒ Object
34 35 36 37 |
# File 'lib/voom/presenters/dsl/components/base.rb', line 34 def extend(_helpers_) if _helpers_ instance_eval(&@block) if @block end |