<commit_before>class Dogsay::TextBox
  include Dogsay::AsciiArt
  attr_reader :text_width, :separator, :justify, :raw
  def initialize(text, opts={})
    @text_width = opts.fetch(:text_width, 40)
    @separator = opts.fetch(:strip, false) ? ' ' : / /
    @justify = opts.fetch(:justify, :center)
    max_width = text.split("\n").map(&:length).max
    @raw = text.boxed(max_width + 4, justify: :ljust)
    @ascii = text.space_at(text_width - 4, on: separator).wrap(text_width - 4).boxed(text_width, justify: justify)
  end
end<commit_msg>Reduce complexity of Dogsay::TextBox<commit_after>class Dogsay::TextBox
  include Dogsay::AsciiArt
  attr_reader :text_width, :separator, :justify, :raw
  def initialize(text, opts={})
    config      = defaults.merge(opts)
    @text_width = config[:text_width]
    @separator  = config[:strip] ? ' ' : / /
    @justify    = config[:justify]
    @raw        = raw_from(text)
    @ascii      = ascii_from(text)
  end

  private

  def ascii_from(text)
    text.space_at(text_width - 4, on: separator)
      .wrap(text_width - 4)
      .boxed(text_width, justify: justify)
  end

  def raw_from(text)
    max_width = text.split("\n").map(&:length).max
    text.boxed(max_width + 4, justify: :ljust)
  end

  def defaults
    {
      text_width: 40,
      strip:      false,
      justify:    :center
    }
  end
end
{'fraction_non_alphanumeric': 0.14, 'fraction_numerical': 0.007407407407407408, 'mean_word_length': 3.2351097178683386, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '79113', 'n_tokens_mistral': 498, 'n_tokens_neox': 472, 'n_words': 97}