<commit_before>require 'facter'
require 'shellwords'

module Death
  class Voice
    class << self
      def say(message)
        new.say(message)
      end
    end

    def initialize(ressure_factor = 3)
      @ressure_factor = ressure_factor
    end

    def say(message)
      raise 'death command is supporting only Mac OS X.' unless supported_os?

      sound_pressure { system("say -v Ralph #{Shellwords.shellescape(message)} &") }
    end

    private

    def sound_pressure
      processor_count = Facter[:processorcount].value

      (processor_count * @ressure_factor).times { yield }
    end

    def supported_os?
      if RUBY_PLATFORM == 'java'
        require 'java'
        java.lang.System.getProperty('os.name') == 'Mac OS X'
      else
        /darwin/ === RUBY_PLATFORM
      end
    end<commit_msg>refactoring<commit_after>require 'facter'
require 'shellwords'

module Death
  class Voice
    class << self
      def say(message)
        new.say(message)
      end
    end

    def initialize(ressure_factor = 3)
      @ressure_factor = ressure_factor
    end

    def say(message)
      raise 'death command is supporting only Mac OS X.' unless supported_os?

      sound_pressure { spawn("say -v Ralph #{Shellwords.shellescape(message)}") }
    end

    private

    def sound_pressure
      processor_count = Facter[:processorcount].value

      (processor_count * @ressure_factor).times { yield }
    end

    def supported_os?
      if RUBY_PLATFORM == 'java'
        require 'java'
        java.lang.System.getProperty('os.name') == 'Mac OS X'
      else
        /darwin/ === RUBY_PLATFORM
      end
    end
{'fraction_non_alphanumeric': 0.09113149847094801, 'fraction_numerical': 0.0012232415902140672, 'mean_word_length': 2.480851063829787, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7513493', 'n_tokens_mistral': 512, 'n_tokens_neox': 487, 'n_words': 129}