<commit_before># encoding: utf-8
# layabout.rb
require 'ostruct'

module Layabout

  def self.rect *args, &block
    Rect.new *args, &block
  end

  #class Rect < OpenStruct
  class Rect
    attr_reader :width, :height, :x, :y

    def initialize width: 0, height: 0, x: 0, y: 0, &block
      @width = width
      @height = height
      @x = x
      @y = y
      @contents = []
      instance_exec &block if block_given?
    end

    def rect name=nil, opts={}
      singleton_class.class_exec { attr_reader name }
      out = instance_variable_set "@#{name}", Layabout.rect(opts)
      @contents << out
      out
    end
  end
end<commit_msg>Pass block along to new rect<commit_after># encoding: utf-8
# layabout.rb
require 'ostruct'

module Layabout

  def self.rect *args, &block
    Rect.new *args, &block
  end

  #class Rect < OpenStruct
  class Rect
    attr_reader :width, :height, :x, :y

    def initialize width: 0, height: 0, x: 0, y: 0, &block
      @width = width
      @height = height
      @x = x
      @y = y
      @contents = []
      instance_exec &block if block_given?
    end

    def rect name=nil, opts={}, &block
      singleton_class.class_exec { attr_reader name }
      out = instance_variable_set "@#{name}", Layabout.rect(opts, &block)
      @contents << out
      out
    end
  end
end
{'fraction_non_alphanumeric': 0.11237661351556567, 'fraction_numerical': 0.007593014426727411, 'mean_word_length': 2.50531914893617, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3342286', 'n_tokens_mistral': 457, 'n_tokens_neox': 440, 'n_words': 142}