<commit_before>
require 'ripl'

module Ripl::Rc; end
module Ripl::Rc::U
  def self.included mod
    mod.send(:include, Ripl::Rc)
    class << mod
      attr_accessor :disabled

      def enable
        self.disabled = false
      end

      def disable
        self.disabled = true
      end

      def enabled?
        !disabled
      end

      def disabled?
        !!disabled
      end
    end

    snake_name = mod.name[/::\w+$/].tr(':', ''). # remove namespaces
                     gsub(/([A-Z][a-z]*)/, '\\1_').downcase[0..-2]
    code = %w[enable disable enabled? disabled?].map{ |meth|
      <<-RUBY
        def #{meth}_#{snake_name}
          #{mod.name}.#{meth}
        end
      RUBY
    }.join("\n")
    module_eval(code)
  end
end

Ripl.extend(Ripl::Rc::U)<commit_msg>u.rb: so Ripl.color_enabled? not Ripl.enabled?_color ...<commit_after>
require 'ripl'

module Ripl::Rc; end
module Ripl::Rc::U
  def self.included mod
    mod.send(:include, Ripl::Rc)
    class << mod
      attr_accessor :disabled

      def enable
        self.disabled = false
      end

      def disable
        self.disabled = true
      end

      def enabled?
        !disabled
      end

      def disabled?
        !!disabled
      end
    end

    snake_name = mod.name[/::\w+$/].tr(':', ''). # remove namespaces
                     gsub(/([A-Z][a-z]*)/, '\\1_').downcase[0..-2]
    code = (%w[enable disable].map{ |meth|
      <<-RUBY
        def #{meth}_#{snake_name}
          #{mod.name}.#{meth}
        end
      RUBY
    } + %w[enabled? disabled?].map{ |meth|
      <<-RUBY
        def #{snake_name}_#{meth}
          #{mod.name}.#{meth}
        end
      RUBY
    }).join("\n")
    module_eval(code)
  end
end

Ripl.extend(Ripl::Rc::U)
{'fraction_non_alphanumeric': 0.16071428571428573, 'fraction_numerical': 0.0034562211981566822, 'mean_word_length': 1.8061389337641358, 'pattern_counts': {'":': 0, '<': 13, '<?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': '7611969', 'n_tokens_mistral': 646, 'n_tokens_neox': 611, 'n_words': 129}