<commit_before>class CountryProfileCliGem::Country

  attr_accessor :name, :isocode
  attr_reader :indicators, :output

  @@all = []

  def initialize(name)
    @name = name
    @isocode = @@list_available[name.to_sym]
    @indicators = []
    # @output = SHOULD IT BE INITIALIZED FIRST?????
    @@all << self
  end

  def self.load_country_list
    @@list_available = CountryProfileCliGem::Scrapper.scrape_country_isocode
  end

  def self.find_by_country_name(country_name)
    self.all.find {|country| country_name == country.name}
  end

  def self.find_or_create_by_name(country_name)
    self.find_by_country_name(country_name) ? self.find_by_country_name(country_name) : self.new(country_name)
  end

  def add_indicator(indicator)
    self.indicators << indicator unless self.indicators.include?(indicator)
    indicator.country = self unless indicator.country = self
  end

  def find_indicator_by_name(name)
    self.indicators.find {|indicator| name == indicator.name}
  end

  def create_indicator(name = "standard", time_period = 1)
    self.add_indicator(CountryProfileCliGem::Indicator.new(name, time_period))
  end

  def output=(output)
    @output = output
    output.country = self unless output.class.all.include?(self)
  end

  def self.all
    @@all
  end

  def country_profile
<commit_msg>rewrite some method in the country class with output method and find_by_name methods<commit_after>class CountryProfileCliGem::Country

  attr_accessor :name, :isocode
  attr_reader :indicators, :output

  @@all = []

  def initialize(name)
    @name = name
    @isocode = @@list_available[name.to_sym]
    @indicators = []
    @@all << self
    @output = CountryProfileCliGem::Output.new
    self.output.country = self unless self.class.all.include?(self)
  end

  def self.load_country_list
    @@list_available = CountryProfileCliGem::Scrapper.scrape_country_isocode
  end

  def self.find_by_country_name(country_name)
    self.all.find {|country| country_name == country.name}
  end

  def self.find_or_create_country_by_name(country_name)
    self.find_by_country_name(country_name) ? self.find_by_country_name(country_name) : self.new(country_name)
  end

  def add_indicator(indicator)
    self.indicators << indicator unless self.indicators.include?(indicator)
    indicator.country = self unless indicator.country = self
  end

  def find_indicator_by_name(name)
    self.indicators.find {|indicator| name == indicator.name}
  end

  def create_indicator(name = "standard", time_period = 1)
    self.add_indicator(CountryProfileCliGem::Indicator.new(name, time_period))
  end

  # def output=(output)
  #   @output = output
  #   output.country = self unless output.class.all.include?(self)
  # end

  def self.all
    @@all
  end

  def country_profile

{'fraction_non_alphanumeric': 0.0994236311239193, 'fraction_numerical': 0.0007204610951008645, 'mean_word_length': 4.309751434034417, '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': '5380647', 'n_tokens_mistral': 966, 'n_tokens_neox': 924, 'n_words': 182}