<commit_before>require 'barby'
require 'barby/barcode/ean_13'
require 'barby/outputter/rmagick_outputter'
require 'rvg/rvg'

module BarcodeDispatcher
  class Base
    include Magick
    attr_accessor :height, :margin, :code
    BASE_HEIGHT = 25

    class << self
      def generate(code, options = {})
        BarcodeDispatcher::Base.new(code, options).to_png
      end
    end

    def initialize(code, params = {})
      @code = code
      p code
      p params
      @labeled = BarcodeDispatcher.labeled
      @height = BarcodeDispatcher.height
      @margin = 0
    end

    def labeled?
      @labeled
    end

    def code_with_format
      [].tap { |parts|
        code.clone.tap do |code_formated|
          3.times { parts << code_formated.slice!(0,4) }
        end
      }.join(' - ')+" #{barcode.checksum}"
    end

    def to_rmagick
      barcode.to_image(height: height, margin: margin)
    end

    def to_png
      labeled? ? labeled : barcode.to_png(height: height, margin: margin)
    end<commit_msg>Remove p<commit_after>require 'barby'
require 'barby/barcode/ean_13'
require 'barby/outputter/rmagick_outputter'
require 'rvg/rvg'

module BarcodeDispatcher
  class Base
    include Magick
    attr_accessor :height, :margin, :code
    BASE_HEIGHT = 25

    class << self
      def generate(code, options = {})
        BarcodeDispatcher::Base.new(code, options).to_png
      end
    end

    def initialize(code, params = {})
      @code = code
      @labeled = BarcodeDispatcher.labeled
      @height = BarcodeDispatcher.height
      @margin = 0
    end

    def labeled?
      @labeled
    end

    def code_with_format
      [].tap { |parts|
        code.clone.tap do |code_formated|
          3.times { parts << code_formated.slice!(0,4) }
        end
      }.join(' - ')+" #{barcode.checksum}"
    end

    def to_rmagick
      barcode.to_image(height: height, margin: margin)
    end

    def to_png
      labeled? ? labeled : barcode.to_png(height: height, margin: margin)
    end
{'fraction_non_alphanumeric': 0.10374064837905236, 'fraction_numerical': 0.00798004987531172, 'mean_word_length': 2.4705882352941178, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6621223', 'n_tokens_mistral': 684, 'n_tokens_neox': 651, 'n_words': 154}