<commit_before>
module Coral
class Codes
  
  #-----------------------------------------------------------------------------
  # Code index
  
  @@index = {}
  
  def self.index(number = nil)
    if number.nil?
      @@index
    else
      number = number.to_i
          
      if @@index.has_key?(number)
        @@index[number]
      else
        @@index[2] # Unknown status
      end  
    end    
  end
  
  #-----------------------------------------------------------------------------
  # Code construction
  
  def self.code(name, number)
    number = number.to_i
    
    # TODO: Add more information to the index (like a help message)
    @@index[number] = name.to_s 
    
    define_method(name) { number }
  end
  
  #-----------------------------------------------------------------------------
  # Code of last resort
  
  def method_missing(method, *args, &block)  
    return unknown_status  
  end
  
  #-----------------------------------------------------------------------------
  # Core status codes
  
  code(:help_wanted, 1)
  code(:unknown_status, 2)
  
  code(:action_unprocessed, 3)
  
end
end<commit_msg>Adding a success code to the core codes class.<commit_after>
module Coral
class Codes
  
  #-----------------------------------------------------------------------------
  # Code index
  
  @@index = {}
  
  def self.index(number = nil)
    if number.nil?
      @@index
    else
      number = number.to_i
          
      if @@index.has_key?(number)
        @@index[number]
      else
        @@index[2] # Unknown status
      end  
    end    
  end
  
  #-----------------------------------------------------------------------------
  # Code construction
  
  def self.code(name, number)
    number = number.to_i
    
    # TODO: Add more information to the index (like a help message)
    @@index[number] = name.to_s 
    
    define_method(name) { number }
  end
  
  #-----------------------------------------------------------------------------
  # Code of last resort
  
  def method_missing(method, *args, &block)  
    return unknown_status  
  end
  
  #-----------------------------------------------------------------------------
  # Core status codes
  
  code(:success, 0)
  code(:help_wanted, 1)
  code(:unknown_status, 2)
  
  code(:action_unprocessed, 3)
  
end
end
{'fraction_non_alphanumeric': 0.3367920449632512, 'fraction_numerical': 0.0038910505836575876, 'mean_word_length': 0.9610169491525423, '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': '2723544', 'n_tokens_mistral': 627, 'n_tokens_neox': 600, 'n_words': 153}