Module: Tuile::Component::Layout::Constraint

Included in:
Clamp, Expand, Fixed, Percent
Defined in:
lib/tuile/component/layout.rb,
sig/tuile.rbs

Overview

What Fixed, Percent, Expand and Clamp have in common: each is a value a Box resolves against the space it has. The set is closed — Box#add accepts these four and nothing else, so an app never implements the protocol.

Instance Method Summary collapse

Instance Method Details

#resolve(available) ⇒ Integer?

@param available — the extent a Box divides.

@return — cells wanted, before the box clamps to what is left; nil for an Expand, which takes a share of the residue instead.

Parameters:

  • available (Integer)

Returns:

  • (Integer, nil)


51
# File 'lib/tuile/component/layout.rb', line 51

def resolve(available) = raise(NotImplementedError, "#{self.class} must implement resolve")