Class: Voom::Presenters::DSL::Components::Table

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

Defined Under Namespace

Classes: Row

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #context, #id, #type

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Serializer

#to_hash

Methods included from Lockable

#lock!, #locked?

Constructor Details

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

Returns a new instance of Table.



15
16
17
18
19
20
# File 'lib/voom/presenters/dsl/components/table.rb', line 15

def initialize(**attribs_, &block)
  super(type: :table, **attribs_, &block)
  @selectable = attribs.delete(:selectable)
  @rows = []
  expand!
end

Instance Attribute Details

#header(**attribs, &block) ⇒ Object

Returns the value of attribute header.



13
14
15
# File 'lib/voom/presenters/dsl/components/table.rb', line 13

def header
  @header
end

#rowsObject

Returns the value of attribute rows.



13
14
15
# File 'lib/voom/presenters/dsl/components/table.rb', line 13

def rows
  @rows
end

#selectableObject

Returns the value of attribute selectable.



13
14
15
# File 'lib/voom/presenters/dsl/components/table.rb', line 13

def selectable
  @selectable
end

Instance Method Details

#row(**attribs, &block) ⇒ Object



29
30
31
32
33
# File 'lib/voom/presenters/dsl/components/table.rb', line 29

def row(**attribs, &block)
  @rows << Row.new(parent: self, type: :row,
                   context: context,
                   **attribs, &block)
end