<commit_before>module Turboforms
  module DataAttribute
    extend ActiveSupport::Concern

    included do
      alias_method_chain :form_for, :data_turboform
    end

    def form_for_with_data_turboform(record_or_name_or_array, *args, &proc)
      options = args.extract_options!

      if options.has_key?(:turboform) && options.delete(:turboform)
        options[:html] ||= {}
        options[:html]["data-turboform"] = true
        options[:remote] = true
      end

      form_for_without_data_turboform(
        record_or_name_or_array,
        *(args << options),
        &proc
      )
    end
  end

  class Engine < ::Rails::Engine
    initializer :turboforms_data_attribute do |app|
      ActionView::Base.send :include, DataAttribute
    end
  end
end<commit_msg>make work for form_tag too<commit_after>module Turboforms
  module DataAttribute
    extend ActiveSupport::Concern

    included do
      alias_method_chain :form_for, :data_turboform
      alias_method_chain :form_tag, :data_turboform
    end

    def form_for_with_data_turboform(record_or_name_or_array, *args, &proc)
      options = args.extract_options!

      if options.has_key?(:turboform) && options.delete(:turboform)
        options[:html] ||= {}
        options[:html]["data-turboform"] = true
        options[:remote] = true
      end

      form_for_without_data_turboform(
        record_or_name_or_array,
        *(args << options),
        &proc
      )
    end

    def form_tag_with_data_turboform(record_or_name_or_array, *args, &proc)
      options = args.extract_options!

      if options.has_key?(:turboform) && options.delete(:turboform)
        options[:html] ||= {}
        options[:html]["data-turboform"] = true
        options[:remote] = true
      end

      form_tag_without_data_turboform(
        record_or_name_or_array,
        *(args << options),
        &proc
      )
    end
  end

  class Engine < ::Rails::Engine
    initializer :turboforms_data_attribute do |app|
      ActionView::Base.send :include, DataAttribute
    end
  end
end
{'fraction_non_alphanumeric': 0.09658536585365854, 'fraction_numerical': 0.0, 'mean_word_length': 2.9594594594594597, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '719236', 'n_tokens_mistral': 686, 'n_tokens_neox': 650, 'n_words': 121}