<commit_before>require 'set'

class Option
  include Comparable

  attr_reader :name, :description, :flag

  def initialize(name, description=nil)
    @name, @flag = split_name(name)
    @description = description.to_s
  end

  def to_s
    flag
  end
  alias_method :to_str, :to_s

  def <=>(other)
    name <=> other.name
  end

  def eql?(other)
    instance_of?(other.class) && name == other.name
  end

  def hash
    name.hash
  end

  def inspect
    "#<#{self.class}: #{flag.inspect}>"
  end

  private

  def split_name(name)
    case name
    when /^[a-zA-Z]$/
      [name, "-#{name}"]
    when /^-[a-zA-Z]$/
      [name[1..1], name]
    when /^--(.+)$/
      [$1, name]
    else
      [name, "--#{name}"]
    end
  end
end

class Options
  include Enumerable

  def initialize(*args)
    @options = Set.new(*args)
  end

  def initialize_copy(other)
    super
    @options = @options.dup
  end

  def each(*args, &block)
    @options.each(*args, &block)
  end
<commit_msg>Add an accessor to make the intent more clear here<commit_after>require 'set'

class Option
  include Comparable

  attr_reader :name, :description, :flag

  def initialize(name, description=nil)
    @name, @flag = split_name(name)
    @description = description.to_s
  end

  def to_s
    flag
  end
  alias_method :to_str, :to_s

  def <=>(other)
    name <=> other.name
  end

  def eql?(other)
    instance_of?(other.class) && name == other.name
  end

  def hash
    name.hash
  end

  def inspect
    "#<#{self.class}: #{flag.inspect}>"
  end

  private

  def split_name(name)
    case name
    when /^[a-zA-Z]$/
      [name, "-#{name}"]
    when /^-[a-zA-Z]$/
      [name[1..1], name]
    when /^--(.+)$/
      [$1, name]
    else
      [name, "--#{name}"]
    end
  end
end

class Options
  include Enumerable

  attr_reader :options
  protected :options

  def initialize(*args)
    @options = Set.new(*args)
  end

  def initialize_copy(other)
    super
    @options = other.options.dup
  end

  def each(*args, &block)
    @options.each(*args, &block)
  end

{'fraction_non_alphanumeric': 0.1451534339990258, 'fraction_numerical': 0.0029225523623964927, 'mean_word_length': 2.517123287671233, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7361482', 'n_tokens_mistral': 777, 'n_tokens_neox': 749, 'n_words': 191}