<commit_before>require 'moon-serializable/load'

module Moon
  class Cuboid
    module Cast
      def self.extract_array(obj)
        case obj.size
        when 2
          pos, size = *obj
          return [*Vector3.extract(pos), *Vector3.extract(size)]
        when 6 then return obj
        else
          raise ArgumentError, "expected Array of size 2 or 6" if obj.size != 6
        end
      end

      def self.extract_hash(obj)
        if obj.key?(:position)
          pos  = obj.fetch(:position)
          size = obj.fetch(:size)
          x, y, z = *Vector3.extract(pos)
          w, h, d = *Vector3.extract(size)
          return x, y, z, w, h, d
        else
          return obj.fetch_multi(:x, :y, :z, :w, :h, :d)
        end
      end

      def self.extract(obj)
        case obj
        when Array   then extract_array(obj)
        when Cuboid  then obj.to_a<commit_msg>std: Removed require in Cuboid<commit_after>module Moon
  class Cuboid
    module Cast
      def self.extract_array(obj)
        case obj.size
        when 2
          pos, size = *obj
          return [*Vector3.extract(pos), *Vector3.extract(size)]
        when 6 then return obj
        else
          raise ArgumentError, "expected Array of size 2 or 6" if obj.size != 6
        end
      end

      def self.extract_hash(obj)
        if obj.key?(:position)
          pos  = obj.fetch(:position)
          size = obj.fetch(:size)
          x, y, z = *Vector3.extract(pos)
          w, h, d = *Vector3.extract(size)
          return x, y, z, w, h, d
        else
          return obj.fetch_multi(:x, :y, :z, :w, :h, :d)
        end
      end

      def self.extract(obj)
        case obj
        when Array   then extract_array(obj)
        when Cuboid  then obj.to_a
{'fraction_non_alphanumeric': 0.09857549857549858, 'fraction_numerical': 0.010256410256410256, 'mean_word_length': 1.6850152905198776, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5372468', 'n_tokens_mistral': 564, 'n_tokens_neox': 547, 'n_words': 171}