Class: Voom::Presenters::DSL::Components::UnorderedList

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/unordered_list.rb

Defined Under Namespace

Classes: ListItem

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ UnorderedList

Returns a new instance of UnorderedList.



9
10
11
12
13
14
# File 'lib/voom/presenters/dsl/components/unordered_list.rb', line 9

def initialize(**attribs_, &block)
  super(type: :unordered_list, **attribs_, &block)
  @list_style = attribs.delete(:list_style){ :disc }
  @list_items = []
  expand!
end

Instance Attribute Details

#list_itemsObject (readonly)

Returns the value of attribute list_items.



7
8
9
# File 'lib/voom/presenters/dsl/components/unordered_list.rb', line 7

def list_items
  @list_items
end

#list_styleObject (readonly)

Returns the value of attribute list_style.



7
8
9
# File 'lib/voom/presenters/dsl/components/unordered_list.rb', line 7

def list_style
  @list_style
end

Instance Method Details

#list_item(text = nil, **attribs_, &block) ⇒ Object



16
17
18
# File 'lib/voom/presenters/dsl/components/unordered_list.rb', line 16

def list_item(text=nil, **attribs_, &block)
  @list_items << ListItem.new(parent: self, text: text, **attribs_, &block)
end