Class: Vident::Stimulus::Base

Inherits:
Literal::Data
  • Object
show all
Includes:
Combinable
Defined in:
lib/vident/stimulus/base.rb

Overview

Shared frozen-value base for the Stimulus primitive value classes (Action, Target, Controller, Outlet, Value, Param, ClassMap). Provides ‘Combinable` (`with`, pattern-matching `deconstruct_keys`) and a default `to_data_hash(items)` that subclasses override when they need non-trivial collection semantics (space-join etc.).

Subclasses still override ‘to_h` / `to_hash` per class — Literal auto-generates a prop-hash `to_h` from the prop DSL that would shadow any default here, so the data-attribute-shape override must live on each concrete class.

Direct Known Subclasses

Action, ClassMap, Controller, Outlet, Param, Target, Value

Class Method Summary collapse

Methods included from Combinable

#deconstruct, #deconstruct_keys, #with

Class Method Details

.to_data_hash(items) ⇒ Object



21
22
23
# File 'lib/vident/stimulus/base.rb', line 21

def self.to_data_hash(items)
  items.to_h(&:to_data_pair)
end