Class: ViewComponentReducible::State::Envelope
- Inherits:
-
Object
- Object
- ViewComponentReducible::State::Envelope
- Defined in:
- lib/view_component_reducible/state/envelope.rb
Overview
Envelope builder for initial state payloads.
Class Method Summary collapse
-
.initial(root_component_klass, path: 'root') ⇒ Hash{String=>Object}
Build an initial envelope for a component.
Class Method Details
.initial(root_component_klass, path: 'root') ⇒ Hash{String=>Object}
Build an initial envelope for a component.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/view_component_reducible/state/envelope.rb', line 11 def self.initial(root_component_klass, path: 'root') schema = root_component_klass.vcr_state_schema data = schema.defaults { 'v' => 1, 'root' => root_component_klass.vcr_id, 'path' => path, 'data' => data, 'children' => {} } end |