Class: Voom::Presenters::DSL::Components::UnorderedList::ListItem
- Defined in:
- lib/voom/presenters/dsl/components/unordered_list.rb
Instance Attribute Summary
Attributes inherited from Base
#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type
Instance Method Summary collapse
- #icon(icon = nil, **attribs, &block) ⇒ Object
-
#initialize(**attribs_, &block) ⇒ ListItem
constructor
A new instance of ListItem.
- #text(*text, **attribs, &block) ⇒ Object
- #unordered_list(**attribs, &block) ⇒ Object
Methods inherited from Base
Methods included from Pluggable
#include_plugins, #plugin, #plugin_module
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(**attribs_, &block) ⇒ ListItem
Returns a new instance of ListItem.
22 23 24 25 26 27 28 |
# File 'lib/voom/presenters/dsl/components/unordered_list.rb', line 22 def initialize(**attribs_, &block) super(type: :list_item, **attribs_, &block) self.text(attribs.delete(:text)) if attribs.key?(:text) self.icon(attribs.delete(:icon)) if attribs.key?(:icon) self.unordered_list(attribs.delete(:unordered_list)) if attribs.key?(:unordered_list) end |
Instance Method Details
#icon(icon = nil, **attribs, &block) ⇒ Object
35 36 37 38 |
# File 'lib/voom/presenters/dsl/components/unordered_list.rb', line 35 def icon(icon=nil, **attribs, &block) return @icon if locked? @icon = Components::Icon.new(parent: self, icon: icon, **attribs, &block) end |
#text(*text, **attribs, &block) ⇒ Object
30 31 32 33 |
# File 'lib/voom/presenters/dsl/components/unordered_list.rb', line 30 def text(*text, **attribs, &block) return @text if locked? @text = Components::Typography.new(parent: self, type: :text, text: text, **attribs, &block) end |
#unordered_list(**attribs, &block) ⇒ Object
40 41 42 43 |
# File 'lib/voom/presenters/dsl/components/unordered_list.rb', line 40 def unordered_list(**attribs, &block) return @unordered_list if locked? @unordered_list = UnorderedList.new(parent: self, **attribs, &block) end |