Module: Phlex::Sorbet::InstanceMethods
- Extended by:
- T::Sig
- Defined in:
- lib/phlex/sorbet/instance_methods.rb
Overview
Instance methods prepended into components that include Phlex::Sorbet. Wraps ‘initialize` to build a typed Props struct from incoming kwargs and exposes each prop as a method on the component instance.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Object
Builds typed props, defines per-prop accessor methods, then calls super so the Phlex base class can initialize as usual.
- #props ⇒ Object
Instance Method Details
#initialize(**kwargs) ⇒ Object
Builds typed props, defines per-prop accessor methods, then calls super so the Phlex base class can initialize as usual.
19 20 21 22 23 |
# File 'lib/phlex/sorbet/instance_methods.rb', line 19 def initialize(**kwargs, &) @props = self.class.build_props(**kwargs) define_prop_accessors if @props super(&) end |
#props ⇒ Object
29 30 31 |
# File 'lib/phlex/sorbet/instance_methods.rb', line 29 def props @props end |