Method: Voom::Presenters::DSL::Components::Lists::Line#initialize

Defined in:
lib/voom/presenters/dsl/components/lists/line.rb

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

Returns a new instance of Line.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/voom/presenters/dsl/components/lists/line.rb', line 15

def initialize(**attribs_, &block)
  super(type: :line, **attribs_, &block)
  @selected = attribs.delete(:selected) {false}
  @selectable = attribs.delete(:selectable) {false}
  self.text(attribs.delete(:text), attribs) if attribs[:text]
  self.subtitle(attribs.delete(:subtitle)) if attribs[:subtitle]
  self.info(attribs.delete(:info)) if attribs[:info]
  self.body(attribs.delete(:body)) if attribs[:body]
  self.avatar(attribs.delete(:avatar)) if attribs.key?(:avatar)
  self.icon(attribs.delete(:icon)) if attribs.key?(:icon)

  if @selectable
    self.checkbox(attribs.slice(*CHECKBOX_ATTRIBUTES))
  elsif attribs.key?(:checkbox)
    self.checkbox(attribs.delete(:checkbox))
  end
  @components = []
  @actions = []
  expand!
end