Module: Weft::DSL::Params
Overview
Mixin for classes that declare consumed inputs — the doors into params.
Provides the param (wire), receives (caller hand-off), and derives
(lazy server-side derivation) class DSL and the params instance reader.
Used by Component (for partial route params) and Page (for page route params).
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Instance access to the resolved bag.
Class Method Summary collapse
- .included(base) ⇒ Object
-
.warned_collisions ⇒ Object
One-time chrome-collision warnings, keyed [class, key].
Instance Method Summary collapse
-
#serializable_params ⇒ Object
private
The bag projected onto this class's own declared wire schema — the only slice that serializes (refresh/stream URLs, DOM ids, hx-vals).
Instance Attribute Details
#params ⇒ Object (readonly)
Instance access to the resolved bag. Returns a Weft::Params object with method-style and hash access.
149 150 151 |
# File 'lib/weft/dsl/params.rb', line 149 def params @params end |
Class Method Details
.included(base) ⇒ Object
13 14 15 |
# File 'lib/weft/dsl/params.rb', line 13 def self.included(base) base.extend(ClassMethods) end |
.warned_collisions ⇒ Object
One-time chrome-collision warnings, keyed [class, key]. See #warn_declared_chrome_collisions.
143 144 145 |
# File 'lib/weft/dsl/params.rb', line 143 def self.warned_collisions @warned_collisions ||= Set.new end |
Instance Method Details
#serializable_params ⇒ 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.
The bag projected onto this class's own declared wire schema — the only slice that serializes (refresh/stream URLs, DOM ids, hx-vals). Hand-offs and inherited values are server-side and never ride the wire. Per-key reads, NOT to_h: serialization must never materialize non-wire derivations (a thunk on a wire-schema key — the rare param+derives dual — does force here; the refresh contract wins).
158 159 160 161 162 |
# File 'lib/weft/dsl/params.rb', line 158 def serializable_params return {} unless params self.class.params.keys.to_h { |key| [key, params[key]] } end |