Module: Vident2::Stimulus::Naming
- Defined in:
- lib/vident2/stimulus/naming.rb
Overview
Pure naming helpers shared across value classes. No state, no inheritance — the v1 ‘StimulusAttributeBase` tree goes away in V2; each value class is a `Literal::Data` and just calls these module functions directly.
Class Method Summary collapse
-
.js_name(name) ⇒ Object
‘:my_thing` -> `“myThing”`.
-
.stimulize_path(path) ⇒ Object
‘“admin/users”` -> `“admin–users”`.
Class Method Details
.js_name(name) ⇒ Object
‘:my_thing` -> `“myThing”`. Used for action method names and target names (not for attribute keys, which dasherize instead).
21 22 23 |
# File 'lib/vident2/stimulus/naming.rb', line 21 def js_name(name) name.to_s.camelize(:lower) end |
.stimulize_path(path) ⇒ Object
‘“admin/users”` -> `“admin–users”`. Symbol or String accepted.
15 16 17 |
# File 'lib/vident2/stimulus/naming.rb', line 15 def stimulize_path(path) path.to_s.split("/").map(&:dasherize).join("--") end |