<commit_before>
require 'ripl'

module Ripl::Rc; end
module Ripl::Rc::Anchor
  def loop_eval(str)
    case obj_or_binding = (config[:rc_anchor] ||= []).last
      when NilClass
        super

      when Binding
        @binding = obj_or_binding
        super

      else
        obj_or_binding.instance_eval(str, "(#{@name})", @line)
    end
  end

  def prompt
    if kind_of?(Ripl::Rc::Color) &&
       obj_or_binding = (config[:rc_anchor] ||= []).last

      super.sub(obj_or_binding.inspect, format_result(obj_or_binding))
    else
      super
    end
  end

  # if the object is the same, then we're exiting from an anchor,
  # so don't print anything.
  def print_result result
    super unless result.object_id == Ripl.config[:rc_anchor_last].object_id
  end

  module Imp
    def anchor obj_or_binding
      if Ripl.config[:rc_init].nil?
        Ripl::Runner.load_rc(Ripl.config[:riplrc])
        Ripl.config[:rc_init] = true
      end

      (Ripl.config[:rc_anchor] ||= []) << obj_or_binding
      Ripl::Shell.create(Ripl.config.merge(
        :name   => obj_or_binding.inspect,<commit_msg>anchor.rb: fix for people only use anchor but color<commit_after>
require 'ripl'

module Ripl::Rc; end
module Ripl::Rc::Anchor
  def loop_eval(str)
    case obj_or_binding = (config[:rc_anchor] ||= []).last
      when NilClass
        super

      when Binding
        @binding = obj_or_binding
        super

      else
        obj_or_binding.instance_eval(str, "(#{@name})", @line)
    end
  end

  def prompt
    if Ripl::Rc.const_defined?(:Color) && kind_of?(Ripl::Rc::Color) &&
       obj_or_binding = (config[:rc_anchor] ||= []).last

      super.sub(obj_or_binding.inspect, format_result(obj_or_binding))
    else
      super
    end
  end

  # if the object is the same, then we're exiting from an anchor,
  # so don't print anything.
  def print_result result
    super unless result.object_id == Ripl.config[:rc_anchor_last].object_id
  end

  module Imp
    def anchor obj_or_binding
      if Ripl.config[:rc_init].nil?
        Ripl::Runner.load_rc(Ripl.config[:riplrc])
        Ripl.config[:rc_init] = true
      end

      (Ripl.config[:rc_anchor] ||= []) << obj_or_binding
      Ripl::Shell.create(Ripl.config.merge(
        :name   => obj_or_binding.inspect,
{'fraction_non_alphanumeric': 0.11922569291684998, 'fraction_numerical': 0.0, 'mean_word_length': 2.887179487179487, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4853782', 'n_tokens_mistral': 821, 'n_tokens_neox': 777, 'n_words': 170}