Module: Teek::UI::OverlayValidator Private

Defined in:
lib/teek/ui/overlay_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.

The opposite direction from WidgetDSL#overlay's own guard: a node carrying overlay placement (+layout+) whose actual parent isn't a :canvas at all - only reachable via direct Node/Document manipulation, since WidgetDSL#overlay already refuses to run outside a ui.canvas block. Mirrors GridValidator.check_stray_cell exactly; overlay intent can land on any node type (whatever #overlay's block happens to build), so like that check - and unlike a type-dispatched WidgetValidators entry - this can't be keyed off a single node type. Validator calls this directly for every node in the same single tree walk.

Class Method Summary collapse

Class Method Details

.check_stray_overlay(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.

Parameters:

  • node (Node)
  • parent (Node, nil)
  • errors (Array<String>)


24
25
26
27
28
29
30
# File 'lib/teek/ui/overlay_validator.rb', line 24

def self.check_stray_overlay(node, parent, errors)
  return unless node.layout && node.layout[:overlay]
  return if parent && parent.type == :canvas

  errors << "#{WidgetValidators.describe(node)} has an overlay position but its parent " \
             "(#{WidgetValidators.describe(parent)}) isn't a ui.canvas - its placement would be silently ignored"
end