Module: Vident::StimulusComponent

Extended by:
ActiveSupport::Concern
Includes:
StimulusAttributes
Included in:
Component
Defined in:
lib/vident/stimulus_component.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StimulusAttributes

#stimulus_action, #stimulus_class, #stimulus_controller, #stimulus_outlet, #stimulus_param, #stimulus_scoped_event, #stimulus_scoped_event_on_window, #stimulus_target, #stimulus_value

Methods included from Vident::Stimulus::Naming

#collection_ivar, #mutator_method, #prop_ivar

Class Method Details

.stimulus_identifier_from_path(path) ⇒ Object

Thin back-compat alias; see ‘Vident::StimulusAttributeBase.stimulize_path` for the canonical implementation.



11
12
13
# File 'lib/vident/stimulus_component.rb', line 11

def stimulus_identifier_from_path(path)
  StimulusAttributeBase.stimulize_path(path)
end

Instance Method Details

#component_nameObject

An name that can helps identify the component type in the DOM or for styling purposes (its also used as a class name on the root element)



69
# File 'lib/vident/stimulus_component.rb', line 69

def component_name = self.class.component_name

#default_controller_pathObject

The ‘component` class name is used to create the controller name. The path of the Stimulus controller when none is explicitly set



73
# File 'lib/vident/stimulus_component.rb', line 73

def default_controller_path = self.class.stimulus_identifier_path

#outlet_idObject

If connecting an outlet to this specific component instance, use this ID



61
62
63
# File 'lib/vident/stimulus_component.rb', line 61

def outlet_id
  @outlet_id ||= [stimulus_identifier, "##{id}"]
end

#stimulus_identifierObject

The Stimulus controller identifier for this component



66
# File 'lib/vident/stimulus_component.rb', line 66

def stimulus_identifier = self.class.stimulus_identifier