Module: Vident::StimulusHelper

Extended by:
ActiveSupport::Concern
Included in:
Component
Defined in:
lib/vident/stimulus_helper.rb

Instance Method Summary collapse

Instance Method Details

#resolve_values_from_props(prop_names) ⇒ Object

Instance method to resolve prop-mapped values at runtime



57
58
59
60
61
62
63
64
# File 'lib/vident/stimulus_helper.rb', line 57

def resolve_values_from_props(prop_names)
  return {} if prop_names.empty?

  prop_names.each_with_object({}) do |name, resolved|
    # Map from instance variable if it exists
    resolved[name] = instance_variable_get("@#{name}") if instance_variable_defined?("@#{name}")
  end
end

#stimulus_dsl_attributesObject

Instance method to get DSL attributes for this component instance



54
# File 'lib/vident/stimulus_helper.rb', line 54

def stimulus_dsl_attributes = self.class.stimulus_dsl_attributes(self)