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



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/vident/stimulus_helper.rb', line 61

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

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

#stimulus_dsl_attributesObject

Instance method to get DSL attributes for this component instance



56
57
58
# File 'lib/vident/stimulus_helper.rb', line 56

def stimulus_dsl_attributes
  self.class.stimulus_dsl_attributes(self)
end