Class: Vident::StimulusParam
- Inherits:
-
StimulusAttributeBase
- Object
- StimulusAttributeBase
- Vident::StimulusParam
- Defined in:
- lib/vident/stimulus_param.rb
Overview
‘data-<controller>-<name>-param=“…”` — readable on the JS side as `event.params.<camelName>`. Element-scoped: every action on the element sees the same params.
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#param_name ⇒ Object
readonly
Returns the value of attribute param_name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from StimulusAttributeBase
Instance Method Summary collapse
Methods inherited from StimulusAttributeBase
#implied_controller_name, #implied_controller_path, #initialize, #inspect, js_name, stimulize_path, #to_h
Constructor Details
This class inherits a constructor from Vident::StimulusAttributeBase
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
8 9 10 |
# File 'lib/vident/stimulus_param.rb', line 8 def controller @controller end |
#param_name ⇒ Object (readonly)
Returns the value of attribute param_name.
8 9 10 |
# File 'lib/vident/stimulus_param.rb', line 8 def param_name @param_name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/vident/stimulus_param.rb', line 8 def value @value end |
Instance Method Details
#data_attribute_name ⇒ Object
12 |
# File 'lib/vident/stimulus_param.rb', line 12 def data_attribute_name = "#{@controller}-#{@param_name}-param" |
#data_attribute_value ⇒ Object
14 |
# File 'lib/vident/stimulus_param.rb', line 14 def data_attribute_value = @value |
#to_s ⇒ Object
10 |
# File 'lib/vident/stimulus_param.rb', line 10 def to_s = @value.to_s |