Module: Weft::Registry::Eligibility
Overview
Class-level routing-eligibility behaviors shared by the base classes that
auto-register with Weft.registry on definition — Component and
Page. Mixed in with extend, so these become class methods on
those bases and their subclasses, and any individual class may override
them. The companion inferred_routable? is defined per base class (its
logic differs: components infer from interactive behavior, pages from
having a usable path).
Instance Method Summary collapse
-
#abstract! ⇒ Object
(also: #dependent!)
Mark this class as a non-routable abstract base, even if its declared state would otherwise make it routable.
-
#routable! ⇒ Object
Force this class to be routable, even if its declared state would otherwise make it non-routable.
-
#routable? ⇒ Boolean
Whether this class auto-routes.
Instance Method Details
#abstract! ⇒ Object Also known as: dependent!
Mark this class as a non-routable abstract base, even if its declared state would otherwise make it routable. Does not percolate to subclasses.
28 29 30 |
# File 'lib/weft/registry/eligibility.rb', line 28 def abstract! @routable_explicit = false end |
#routable! ⇒ Object
Force this class to be routable, even if its declared state would otherwise make it non-routable. Does not percolate to subclasses.
39 40 41 |
# File 'lib/weft/registry/eligibility.rb', line 39 def routable! @routable_explicit = true end |
#routable? ⇒ Boolean
Whether this class auto-routes. An explicit override via #abstract! or
#routable! takes precedence; otherwise routability is inferred (see the
per-class inferred_routable?).
The override is stored as an instance variable on the declaring class object, so it does not percolate to subclasses — an abstract base can have concrete subclasses that auto-route normally.
20 21 22 23 24 |
# File 'lib/weft/registry/eligibility.rb', line 20 def routable? return @routable_explicit if instance_variable_defined?(:@routable_explicit) inferred_routable? end |