Module: Teek::UI::GridValidator Private
- Defined in:
- lib/teek/ui/grid_validator.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
A grid's own contract: every direct child needs a cell
(+g.cell(row:, col:) { }+), and no two children can claim the same
one. Realizer#arrange_grid still raises on a missing cell too
(kept as a belt-and-suspenders backstop for the one path that skips
validation entirely - Session#add's incremental realize), but this
is the primary detection, so the mistake surfaces pre-realize,
collected alongside every other problem, instead of crashing
mid-realize. Composed into WidgetValidators via :grid's own
WidgetType#validator (see widget_types/grid.rb).
Class Method Summary collapse
- .call(node, parent, document, errors) ⇒ void private
-
.check_stray_cell(node, parent, errors) ⇒ void
private
The opposite direction from GridValidator.check_missing_cell: a node carrying a grid-cell position (+layout+) whose actual parent isn't a :grid at all - only reachable via direct Node/Document manipulation, since WidgetDSL#cell already refuses to run outside a ui.grid block.
Class Method Details
.call(node, parent, document, errors) ⇒ void
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.
This method returns an undefined value.
26 27 28 29 |
# File 'lib/teek/ui/grid_validator.rb', line 26 def self.call(node, parent, document, errors) check_missing_cell(node, errors) check_cell_collisions(node, errors) end |
.check_stray_cell(node, parent, errors) ⇒ void
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.
This method returns an undefined value.
The opposite direction from check_missing_cell: a node carrying a grid-cell position (+layout+) whose actual parent isn't a :grid at all - only reachable via direct Node/Document manipulation, since WidgetDSL#cell already refuses to run outside a ui.grid block. Cell intent can land on any node type (whatever #cell's block happens to build), so unlike call above - dispatched through the registry only when visiting a :grid - this can't be keyed off a single node type there. Validator calls this directly for every node instead, in the same single tree walk.
80 81 82 83 84 85 86 |
# File 'lib/teek/ui/grid_validator.rb', line 80 def self.check_stray_cell(node, parent, errors) return unless node.layout && node.layout[:cell] return if parent && parent.type == :grid errors << "#{WidgetValidators.describe(node)} has a grid cell position but its parent " \ "(#{WidgetValidators.describe(parent)}) isn't a ui.grid - its row/col/span would be silently ignored" end |