<commit_before>class HTML5FormBuilder < Formtastic::SemanticFormBuilder
  def name_for(method)
    "#{object_name}[#{method.to_s}]"
  end

protected

  def input_with_html5_required(method, options = {})
    options[:required] = method_required?(method) unless options.key?(:required)
    if options[:required]
      (options[:input_html] ||= {})[:required] = 'required'
    end
    input_without_html5_required(method, options)
  end

  alias_method_chain :input, :html5_required

  def numeric_input(method, options)
    basic_input_helper(:number_field, :numeric, method, options)
  end
  def number_field(method, options)
    ::ActionView::Helpers::InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag('number', options)
  end

  def email_input(method, options)
    basic_input_helper(:email_field, :string, method, options)
  end
  def email_field(method, options)
    ::ActionView::Helpers::InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag('email', options)
  end

  def url_input(method, options)
    basic_input_helper(:url_field, :string, method, options)
  end
  def url_field(method, options)
    ::ActionView::Helpers::InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag('url', options)
  end

end

Formtastic::SemanticFormHelper.builder = HTML5FormBuilder<commit_msg>added date type<commit_after>class HTML5FormBuilder < Formtastic::SemanticFormBuilder
  def name_for(method)
    "#{object_name}[#{method.to_s}]"
  end

protected

  def input_with_html5_required(method, options = {})
    options[:required] = method_required?(method) unless options.key?(:required)
    if options[:required]
      (options[:input_html] ||= {})[:required] = 'required'
    end
    input_without_html5_required(method, options)
  end

  alias_method_chain :input, :html5_required

  def numeric_input(method, options)
    basic_input_helper(:number_field, :numeric, method, options)
  end
  def number_field(method, options)
    ::ActionView::Helpers::InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag('number', options)
  end

  def email_input(method, options)
    basic_input_helper(:email_field, :string, method, options)
  end
  def email_field(method, options)
    ::ActionView::Helpers::InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag('email', options)
  end

  def url_input(method, options)
    basic_input_helper(:url_field, :string, method, options)
  end
  def url_field(method, options)
    ::ActionView::Helpers::InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag('url', options)
  end

  def date_input(method, options)
    basic_input_helper(:date_field, :string, method, options)
  end
  def date_field(method, options)
    ::ActionView::Helpers::InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag('date', options)
  end
end

Formtastic::SemanticFormHelper.builder = HTML5FormBuilder
{'fraction_non_alphanumeric': 0.12356604392002622, 'fraction_numerical': 0.0032776138970829235, 'mean_word_length': 6.249406175771972, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6405608', 'n_tokens_mistral': 963, 'n_tokens_neox': 966, 'n_words': 180}