Files
openfoodnetwork/app/components/multiple_checked_select_component.rb
2022-10-11 10:05:06 +02:00

10 lines
292 B
Ruby

# frozen_string_literal: true
class MultipleCheckedSelectComponent < ViewComponent::Base
def initialize(name:, options:, selected:)
@name = name
@options = options.map { |option| [option[0], option[1].to_sym] }
@selected = selected.nil? ? [] : selected.map(&:to_sym)
end
end