Class: Vident::StimulusControllerCollection

Inherits:
StimulusCollectionBase show all
Defined in:
lib/vident/stimulus_controller_collection.rb

Instance Method Summary collapse

Methods inherited from StimulusCollectionBase

#<<, #any?, #empty?, #initialize, #merge, merge, #to_a, #to_hash

Constructor Details

This class inherits a constructor from Vident::StimulusCollectionBase

Instance Method Details

#to_hObject



5
6
7
8
9
10
11
12
# File 'lib/vident/stimulus_controller_collection.rb', line 5

def to_h
  return {} if items.empty?

  controller_values = items.map(&:to_s).reject(&:empty?)
  return {} if controller_values.empty?

  {controller: controller_values.join(" ")}
end