<commit_before>require "flap/version"

module Flap
  def self.included(base)
    Module.__send__ :include, ModuleMethods
  end

  def instance_tap_eval(&block)
    self.instance_eval &block if block_given?
    self
  end

  def flap(&block)
    warn "[deprecated] this method will be removed."
    instance_tap_eval &block
  end

  module ModuleMethods
    def class_tap_eval(&block)
      class_eval &block if block_given?
      self
    end
  end

  def self.enable_short_methods!
    Object.__send__ :include, ShortMethods
  end

  module ShortMethods
    def self.included(base)
      base.class_eval do
        alias_method :itap, :instance_tap_eval
        Module.class_eval do
          alias_method :ctap, :class_tap_eval
        end
      end
    end
  end
end

Object.__send__ :include, Flap<commit_msg>Write documentation<commit_after>require "flap/version"

module Flap
  def self.included(base)
    Module.__send__ :include, ModuleMethods
  end

  # Public: tap + instance_eval
  #
  # block - call in receiver's context
  #
  # Examples
  #   hash = {a: 1, b: 2}
  #   hash.instance_tap_eval { delete :a } #=> {:b => 2}
  #
  # Returns self
  def instance_tap_eval(&block)
    self.instance_eval &block if block_given?
    self
  end

  # Deprecated: same as instance_tap_eval
  def flap(&block)
    warn "[deprecated] this method will be removed."
    instance_tap_eval &block
  end

  module ModuleMethods
    # Public: tap + class_eval
    #
    # block - call in class context
    #
    # Examples
    #   Klass = Class.new.class_tap_eval { include Awesome }
    #   Klass.new.awesome_method
    #
    # Returns self
    def class_tap_eval(&block)
      class_eval &block if block_given?
      self
    end
  end

  # Public: define alias methods itap/ctap.
  #
  # Returns self
  def self.enable_short_methods!
    Object.__send__ :include, ShortMethods
  end

  module ShortMethods
    def self.included(base)
      base.class_eval do
        alias_method :itap, :instance_tap_eval
        Module.class_eval do
          alias_method :ctap, :class_tap_eval
        end
      end
    end
  end
end

Object.__send__ :include, Flap
{'fraction_non_alphanumeric': 0.074487895716946, 'fraction_numerical': 0.0013966480446927375, 'mean_word_length': 2.7115716753022454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '444762', 'n_tokens_mistral': 726, 'n_tokens_neox': 688, 'n_words': 186}