<commit_before>#
# Copyright (c) 2013-2017 SKYARCH NETWORKS INC.
#
# This software is released under the MIT License.
#
# http://opensource.org/licenses/mit-license.php
#

module FormHelper
  def parts_select(options: nil, selected_option: nil, klass: nil, attributes: nil)
    selected_empty_option = please_select_option(selected_option) if selected_option
    <<~TEMPLATE.html_safe
      <select class="form-control #{klass}" #{attributes}>
        #{selected_empty_option if selected_option}
        #{options}
      </select>
    TEMPLATE
  end

  def parts_input(type: 'text', klass: nil, placeholder: nil, attributes: nil)
    "<input type=\"#{type}\" class=\"form-control #{klass}\" #{"placeholder=\"#{placeholder}\"" if placeholder} #{attributes}>".html_safe
  end

  def please_select_option(msg = I18n.t('common.please_select'))
    %(<option value="" selected>#{msg}</option>).html_safe
  end
end<commit_msg>Fix: ruby部分をリファクタリング<commit_after>#
# Copyright (c) 2013-2017 SKYARCH NETWORKS INC.
#
# This software is released under the MIT License.
#
# http://opensource.org/licenses/mit-license.php
#

module FormHelper
  def parts_select(options: nil, selected_option: nil, klass: nil, attributes: nil)
    selected_empty_option = please_select_option(selected_option) if selected_option
    <<~TEMPLATE.html_safe
      <select class="form-control #{klass}" #{attributes}>
        #{selected_empty_option if selected_option}
        #{options}
      </select>
    TEMPLATE
  end

  def parts_input(type: 'text', klass: nil, placeholder: nil, attributes: nil)
    "<input type=\"#{type}\" class=\"form-control #{klass}\" #{"placeholder=\"#{placeholder}\"" if placeholder} #{attributes}>".html_safe
  end

  def please_select_option(msg = I18n.t('common.please_select'))
    content_tag(:option, msg, value: '', selected: true)
  end
end
{'fraction_non_alphanumeric': 0.14200542005420055, 'fraction_numerical': 0.01084010840108401, 'mean_word_length': 4.577039274924472, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, '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': '4707956', 'n_tokens_mistral': 595, 'n_tokens_neox': 586, 'n_words': 140}