<commit_before>require 'mspec/guards/guard'

class PlatformGuard < SpecGuard
  def self.implementation?(*args)
    args.any? do |name|
      case name
      when :rubinius
        RUBY_ENGINE.start_with?('rbx')
      else
        RUBY_ENGINE.start_with?(name.to_s)
      end
    end
  end

  def self.standard?
    implementation? :ruby
  end

  PLATFORM = if RUBY_ENGINE == "jruby"
    require 'rbconfig'
    "#{RbConfig::CONFIG['host_cpu']}-#{RbConfig::CONFIG['host_os']}"
  else
    RUBY_PLATFORM
  end

  def self.os?(*oses)
    oses.any? do |os|
      raise ":java is not a valid OS" if os == :java
      if os == :windows
        PLATFORM =~ /(mswin|mingw)/
      else
        PLATFORM.include?(os.to_s)
      end
    end
  end

  def self.windows?
    os?(:windows)
  end

  WORD_SIZE = 1.size * 8

  POINTER_SIZE = begin
    require 'rbconfig/sizeof'
    RbConfig::SIZEOF["void*"] * 8<commit_msg>spec: add wsl guard<commit_after>require 'mspec/guards/guard'

class PlatformGuard < SpecGuard
  def self.implementation?(*args)
    args.any? do |name|
      case name
      when :rubinius
        RUBY_ENGINE.start_with?('rbx')
      else
        RUBY_ENGINE.start_with?(name.to_s)
      end
    end
  end

  def self.standard?
    implementation? :ruby
  end

  PLATFORM = if RUBY_ENGINE == "jruby"
    require 'rbconfig'
    "#{RbConfig::CONFIG['host_cpu']}-#{RbConfig::CONFIG['host_os']}"
  else
    RUBY_PLATFORM
  end

  def self.os?(*oses)
    oses.any? do |os|
      raise ":java is not a valid OS" if os == :java
      case os
      when :windows
        PLATFORM =~ /(mswin|mingw)/
      when :wsl
        wsl?
      else
        PLATFORM.include?(os.to_s)
      end
    end
  end

  def self.windows?
    os?(:windows)
  end

  def self.wsl?
    if defined?(@wsl_p)
      @wsl_p
    else
      @wsl_p = `uname -r`.match?(/microsoft/i)
    end
  end

  WORD_SIZE = 1.size * 8

  POINTER_SIZE = begin
    require 'rbconfig/sizeof'
    RbConfig::SIZEOF["void*"] * 8
{'fraction_non_alphanumeric': 0.12291350531107739, 'fraction_numerical': 0.0030349013657056147, 'mean_word_length': 2.3696763202725726, 'pattern_counts': {'":': 2, '<': 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': '5368056', 'n_tokens_mistral': 773, 'n_tokens_neox': 728, 'n_words': 163}