Module: Plushie::Widget::Table::RowValidation

Included in:
Plushie::Widget::Table
Defined in:
lib/plushie/widget/table.rb

Overview

Row validation hooks applied via prepend.

Instance Method Summary collapse

Instance Method Details

#initialize(id, **opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Validate rows on construction and set_rows.



35
36
37
38
# File 'lib/plushie/widget/table.rb', line 35

def initialize(id, **opts)
  super
  validate_rows!(@rows, @columns) if @rows
end

#set_rows(rows) ⇒ Object

Override set_rows with validation.



41
42
43
44
# File 'lib/plushie/widget/table.rb', line 41

def set_rows(rows)
  validate_rows!(rows, @columns)
  dup.tap { |copy| copy.instance_variable_set(:@rows, rows) }
end