class SvelteOnRails::Lib::SvelteAttributes

def set_labels(record, keys)

def set_labels(record, keys)
  first_hash = keys.find { |element| element.is_a?(Hash) }
  _keys = keys.reject { |element| element.is_a?(Hash) }
  _keys += first_hash.keys if first_hash
  _keys.each do |attr|
    unless attr.respond_to?(:each)
      obj = if record.respond_to?(:human_attribute_name)
              record
            elsif record.class.respond_to?(:human_attribute_name)
              record.class
            end
      next unless obj
      @labels["#{obj.to_s.underscore}_labels"] ||= {}
      @labels["#{obj.to_s.underscore}_labels"][attr.to_s] ||= obj.human_attribute_name(attr)
    end
  end
end