<commit_before># Polisher Core Ruby Extensions
#
# Licensed under the MIT license
# Copyright (C) 2013-2014 Red Hat, Inc.

require 'polisher/rpmspec'

class Object
  def eigenclass
    class << self
      self
    end
  end
end

module ConfHelpers
  def conf_attr(name, default=nil)
    self.send(:define_singleton_method, name) do |*args|
      nvar = "@#{name}".intern
      current = self.instance_variable_get(nvar)
      envk    = "POLISHER_#{name.to_s.upcase}"
      self.instance_variable_set(nvar, default)    unless current
      self.instance_variable_set(ENV[envk])        if ENV.has_key?(envk)
      self.instance_variable_set(nvar, args.first) unless args.empty?
      self.instance_variable_get(nvar)
    end

    self.send(:define_method, name) do
      self.class.send(name)
    end
  end
end

class String
  # Return bool indicating if self is a path to a gem
  def gem?
    File.extname(self) == ".gem"
  end

  # Return bool indicating if self is a path to a gemspec
  def gemspec?
    File.extname(self) == ".gemspec"
  end

  # Return bool indicating if self is a path to a Gemfile
  def gemfile?
    File.basename(self) == "Gemfile"
  end
<commit_msg>Follow up TODO comment<commit_after># Polisher Core Ruby Extensions
#
# Licensed under the MIT license
# Copyright (C) 2013-2014 Red Hat, Inc.

require 'polisher/rpmspec'

class Object
  def eigenclass
    class << self
      self
    end
  end
end

module ConfHelpers
  def conf_attr(name, default=nil)
    self.send(:define_singleton_method, name) do |*args|
      nvar = "@#{name}".intern
      current = self.instance_variable_get(nvar)
      envk    = "POLISHER_#{name.to_s.upcase}"
      self.instance_variable_set(nvar, default)    unless current
      self.instance_variable_set(ENV[envk])        if ENV.has_key?(envk)
      # TODO also allow vars to be able to be set from a conf file
      self.instance_variable_set(nvar, args.first) unless args.empty?
      self.instance_variable_get(nvar)
    end

    self.send(:define_method, name) do
      self.class.send(name)
    end
  end
end

class String
  # Return bool indicating if self is a path to a gem
  def gem?
    File.extname(self) == ".gem"
  end

  # Return bool indicating if self is a path to a gemspec
  def gemspec?
    File.extname(self) == ".gemspec"
  end

  # Return bool indicating if self is a path to a Gemfile
  def gemfile?
    File.basename(self) == "Gemfile"
  end

{'fraction_non_alphanumeric': 0.09124690338563171, 'fraction_numerical': 0.006606110652353427, 'mean_word_length': 3.0722689075630254, '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': '6396868', 'n_tokens_mistral': 821, 'n_tokens_neox': 808, 'n_words': 243}