<commit_before>class Array
  def separate(&block)
    passed, failed = [], []
    each do |item|
      if block.call(item)
        passed << item
      else
        failed << item
      end
    end
    [passed, failed]
  end unless method_defined?(:separate)
  
  def avg(&block)
    sum(&block).to_f / length
  end
end

module Enumerable
  def sum(identity = 0, &block)
    return identity unless size > 0

    if block_given?
      map(&block).sum
    else
      inject { |sum, element| sum + element }
    end
  end unless method_defined?(:sum)
end

class Float
  unless method_defined?(:round_with_precision)
    def round_with_precision(precision = nil)
      precision.nil? ? round_without_precision : (self * (10 ** precision)).round / (10 ** precision).to_f
    end
    alias_method :round_without_precision, :round
    alias_method :round, :round_with_precision
  end
end

class Object
  def metaclass
    class << self; self; end
  end unless method_defined?(:metaclass)
  
  def tap
    yield self
    self
  end unless method_defined?(:tap)<commit_msg>Making Float#round play nice with Rails.<commit_after>class Array
  def separate(&block)
    passed, failed = [], []
    each do |item|
      if block.call(item)
        passed << item
      else
        failed << item
      end
    end
    [passed, failed]
  end unless method_defined?(:separate)
  
  def avg(&block)
    sum(&block).to_f / length
  end
end

module Enumerable
  def sum(identity = 0, &block)
    return identity unless size > 0

    if block_given?
      map(&block).sum
    else
      inject { |sum, element| sum + element }
    end
  end unless method_defined?(:sum)
end

class Float
  def round_with_task_tempest(precision = nil)
    precision.nil? ? round_without_task_tempest : (self * (10 ** precision)).round / (10 ** precision).to_f
  end
  alias_method :round_without_task_tempest, :round
  alias_method :round, :round_with_task_tempest
end

class Object
  def metaclass
    class << self; self; end
  end unless method_defined?(:metaclass)
  
  def tap
    yield self
    self
  end unless method_defined?(:tap)
{'fraction_non_alphanumeric': 0.0951022349025202, 'fraction_numerical': 0.005706134094151213, 'mean_word_length': 2.940074906367041, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 5, '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': '108526', 'n_tokens_mistral': 690, 'n_tokens_neox': 661, 'n_words': 193}