<commit_before>require 'ostruct'

module Browser; module DOM; class Event

class Custom < Event
  def self.supported?
    not $$[:CustomEvent].nil?
  end

  def self.create(name, &block)
    data = OpenStruct.new
    block.call(data) if block

    new(`new CustomEvent(#{name}, { detail: #{data.to_n} })`)
  end

  def initialize(native)
    super(native)

    @detail = Hash.new(`#{native}.detail`)
  end

  def method_missing(id, *)
    return @detail[id] if @detail.has_key?(id)

    super
  end
end

end; end; end
<commit_msg>event/custom: temporary fix<commit_after>require 'ostruct'

module Browser; module DOM; class Event

class Custom < Event
  def self.supported?
    not $$[:CustomEvent].nil?
  end

  def self.create(name, &block)
    data = OpenStruct.new
    block.call(data) if block

    new(`new CustomEvent(#{name}, { detail: #{data.to_n} })`)
  end

  def initialize(native)
    super(native); @native = native # TODO: remove this when super is fixed

    @detail = Hash.new(`#{native}.detail`)
  end

  def method_missing(id, *)
    return @detail[id] if @detail.has_key?(id)

    super
  end
end

end; end; end

{'fraction_non_alphanumeric': 0.1351590106007067, 'fraction_numerical': 0.0, 'mean_word_length': 3.4782608695652173, 'pattern_counts': {'":': 0, '<': 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': '4018557', 'n_tokens_mistral': 391, 'n_tokens_neox': 380, 'n_words': 105}