<commit_before>RSpec.describe 'JSON serialization' do
  include Dry::Monads::Maybe::Mixin

  let(:example_structure) do
    {
      'some' => Some(3),
      'none' => None()
    }
  end

  subject { JSON.load(JSON.dump(example_structure)) }

  it 'cannot deserialize without require the monad class extension' do
    is_expected.not_to eql(example_structure)
  end

  it 'should rebuild the example structure' do
    # Need to create a subprocess with Kernel#fork
    # to have always an unloaded json/add/dry/monads/maybe.rb file
    Kernel.fork do
      # must be required manually to provide the JSON serialization
      # class extension ONLY in the subprocess
      require 'json/add/dry/monads/maybe'

      is_expected.to eql(example_structure)
    end
  end
end<commit_msg>removed NotImplemended Kernel#fork block to be valid for JRuby<commit_after>require 'json'

# must be required manually to provide the JSON serialization
require 'json/add/dry/monads/maybe'

RSpec.describe 'JSON serialization' do
  include Dry::Monads::Maybe::Mixin

  let(:example_structure) do
    {
      'some' => Some(3),
      'none' => None()
    }
  end

  subject { JSON.load(JSON.dump(example_structure)) }

  it 'should rebuild the example structure' do
    is_expected.to eql(example_structure)
  end
end
{'fraction_non_alphanumeric': 0.09097918272937548, 'fraction_numerical': 0.0015420200462606013, 'mean_word_length': 3.5543859649122806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1451177', 'n_tokens_mistral': 417, 'n_tokens_neox': 394, 'n_words': 120}