Class: Ui::DescriptiveList::Item

Inherits:
Component
  • Object
show all
Defined in:
lib/ui/descriptive_list/item.rb

Constant Summary

Constants inherited from Component

Component::VIEWPATH

Instance Method Summary collapse

Methods inherited from Component

#capture, #icon, #render_group

Instance Method Details

#display(value) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/ui/descriptive_list/item.rb', line 21

def display(value)
  if value.is_a?(Proc)
    value.call
  else
    value
  end
end

#item_titleObject



29
30
31
# File 'lib/ui/descriptive_list/item.rb', line 29

def item_title
  model[0]
end

#item_valueObject



33
34
35
# File 'lib/ui/descriptive_list/item.rb', line 33

def item_value
  model[1]
end

#showObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/ui/descriptive_list/item.rb', line 4

def show
  (
    :div,
    render_group([
      (:dt, item_title),
      (:dd, value)
    ]),
    class: 'ui-descriptive-list__item'
  )
end

#valueObject



15
16
17
18
19
# File 'lib/ui/descriptive_list/item.rb', line 15

def value
  render_group([
    display(item_value)
  ])
end