<commit_before># -*- encoding: utf-8 -*-
require 'string_util'
require 'name_util'
require 'type_util'
require 'star_util'
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  include NameUtil
  include TypeUtil

  def url_for_bp_pic_popup(callback = :setBpPic)
    url_for :controller => :bp_pic, :action => :list, :popup =>1, :callback => callback
  end

  def bp_pic_edit_icon(bp_pic)
    back_to_link(image_tag((bp_pic.memo.blank? ? 'icon-edit.png' : 'icon-comment.png')), {:action => :edit, :id => bp_pic}, :title => bp_pic.memo)
  end

  def _date(date)
    if date.blank?
      ""
    elsif date.year == Time.now.year
      date.strftime("%m/%d")
    else
      date.strftime("%Y/%m/%d")
    end
  end

  def _time(time)
    if time.blank?
      ""
    elsif [ActiveSupport::TimeWithZone, Time, Date].include?(time.class)
      t = time.to_time.getlocal
      if t.today?
        t.strftime("%H:%M")
      elsif t.year == Time.now.year
        t.strftime("%m/%d")
      else
        t.strftime("%Y/%m/%d")
      end
    else
      time
    end
  end

  def _time_long(time)
    if time.blank?
      ""
    elsif [ActiveSupport::TimeWithZone, Time, Date].include?(time.class)
      t = time.to_time.getlocal.strftime("%Y/%m/%d %H:%M:%S")
    else
      time
    end
  end

  def logged_in?
    auth_signed_in?
  end

  def current_user
    current_auth
  end

  def show_default_initial_amount(x)
    over_super? ? x : '※ 表示できません'
  end

  def over_super?
    logged_in? && ['super'].include?(current_user.access_level_type)
  end

  def over_account?
    logged_in? && ['super','account'].include?(current_user.access_level_type)
  end

  def over_normal?
    logged_in? && ['super','account','normal'].include?(current_user.access_level_type)
  end


  def edit?
    ["edit","update"].include?(controller.action_name)
  end<commit_msg>「歳」を追加するヘルパーメソッドを追加<commit_after># -*- encoding: utf-8 -*-
require 'string_util'
require 'name_util'
require 'type_util'
require 'star_util'
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  include NameUtil
  include TypeUtil

  def url_for_bp_pic_popup(callback = :setBpPic)
    url_for :controller => :bp_pic, :action => :list, :popup =>1, :callback => callback
  end

  def bp_pic_edit_icon(bp_pic)
    back_to_link(image_tag((bp_pic.memo.blank? ? 'icon-edit.png' : 'icon-comment.png')), {:action => :edit, :id => bp_pic}, :title => bp_pic.memo)
  end

  def _date(date)
    if date.blank?
      ""
    elsif date.year == Time.now.year
      date.strftime("%m/%d")
    else
      date.strftime("%Y/%m/%d")
    end
  end

  def _time(time)
    if time.blank?
      ""
    elsif [ActiveSupport::TimeWithZone, Time, Date].include?(time.class)
      t = time.to_time.getlocal
      if t.today?
        t.strftime("%H:%M")
      elsif t.year == Time.now.year
        t.strftime("%m/%d")
      else
        t.strftime("%Y/%m/%d")
      end
    else
      time
    end
  end

  def _time_long(time)
    if time.blank?
      ""
    elsif [ActiveSupport::TimeWithZone, Time, Date].include?(time.class)
      t = time.to_time.getlocal.strftime("%Y/%m/%d %H:%M:%S")
    else
      time
    end
  end

  def _age(age)
    # 「歳」が二重に表示された場合、DBに入ってるデータがおかしい
    # DBに入れる段階で数値（String）のみにしておくこと
    age.blank? ? age : age + "歳"
  end

  def logged_in?
    auth_signed_in?
  end

  def current_user
    current_auth
  end

  def show_default_initial_amount(x)
    over_super? ? x : '※ 表示できません'
  end

  def over_super?
    logged_in? && ['super'].include?(current_user.access_level_type)
  end

  def over_account?
    logged_in? && ['super','account'].include?(current_user.access_level_type)
  end

  def over_normal?
    logged_in? && ['super','account','normal'].include?(current_user.access_level_type)
  end


  def edit?
    ["edit","update"].include?(controller.action_name)
  end
{'fraction_non_alphanumeric': 0.14060913705583755, 'fraction_numerical': 0.0010152284263959391, 'mean_word_length': 3.0670794633642933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '4130778', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1458, 'n_words': 290}