<commit_before>
module Drydock
  class CliFlags

    def initialize(flags = {})
      @flags = flags
    end

    def to_s
      return '' if flags.nil? || flags.empty?

      buffer = StringIO.new
      flags.each_pair do |k, v|
        buffer << process_flag(k, v)
      end

      buffer.string
    end

    private
    attr_reader :flags

    def process_flag(key, value)
      key = key.to_s
      if key.size.one?
        "-#{key} "
      else
        key = key.gsub(/_/, '-')
        case value
        when TrueClass
          "--#{key} "
        when FalseClass
          "--no-#{key} "
        else
          "--#{key} #{process_value(value)}"
        end
      end
    end

    def process_value(value)
      value = value.to_s
      value.match(/\s/) ? value.inspect : value
    end

  end
end<commit_msg>cli_flags: darn, I guess #one? is not a method<commit_after>
module Drydock
  class CliFlags

    def initialize(flags = {})
      @flags = flags
    end

    def to_s
      return '' if flags.nil? || flags.empty?

      buffer = StringIO.new
      flags.each_pair do |k, v|
        buffer << process_flag(k, v)
      end

      buffer.string
    end

    private
    attr_reader :flags

    def process_flag(key, value)
      key = key.to_s
      if key.size == 1
        "-#{key} "
      else
        key = key.gsub(/_/, '-')
        case value
        when TrueClass
          "--#{key} "
        when FalseClass
          "--no-#{key} "
        else
          "--#{key} #{process_value(value)}"
        end
      end
    end

    def process_value(value)
      value = value.to_s
      value.match(/\s/) ? value.inspect : value
    end

  end
end
{'fraction_non_alphanumeric': 0.11637672465506899, 'fraction_numerical': 0.0005998800239952009, 'mean_word_length': 1.5272727272727273, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6477604', 'n_tokens_mistral': 552, 'n_tokens_neox': 540, 'n_words': 140}