<commit_before>require "chat"
require "auction_message_translator"
require "auction_sniper"

class App
  class Auction
    def initialize(item_id)
      @item_id = item_id
    end

    def bid(amount)
      Chat.instance.send_message("sniper", "auction-#{@item_id}", "SOLVersion: 1.1; Command: BID; Price: #{amount};")
    end
  end

  def initialize(ui, item_id)
    @ui = ui

    chat = Chat.instance 
    chat.listen("sniper", "auction-#{item_id}") do |message|
      translator = AuctionMessageTranslator.new(AuctionSniper.new(Auction.new(item_id), self))
      translator.process_message(chat, message)
    end
    chat.send_message("sniper", "auction-#{item_id}", "SOLVersion: 1.1; Command: JOIN;")
  end

  def sniper_lost
    @ui.status = "lost"
  end

  def sniper_bidding
    @ui.status = "bidding"<commit_msg>Extracting join into the Auction.<commit_after>require "chat"
require "auction_message_translator"
require "auction_sniper"

class App
  class Auction
    def initialize(chat, item_id)
      @chat = chat
      @item_id = item_id
    end

    def bid(amount)
      @chat.send_message("sniper", "auction-#{@item_id}", "SOLVersion: 1.1; Command: BID; Price: #{amount};")
    end

    def join
      @chat.send_message("sniper", "auction-#{@item_id}", "SOLVersion: 1.1; Command: JOIN;")
    end
  end

  def initialize(ui, item_id)
    @ui = ui

    chat = Chat.instance 
    auction = Auction.new(chat, item_id)

    chat.listen("sniper", "auction-#{item_id}") do |message|
      translator = AuctionMessageTranslator.new(AuctionSniper.new(auction, self))
      translator.process_message(chat, message)
    end

    auction.join
  end

  def sniper_lost
    @ui.status = "lost"
  end

  def sniper_bidding
    @ui.status = "bidding"
{'fraction_non_alphanumeric': 0.12857142857142856, 'fraction_numerical': 0.004571428571428572, 'mean_word_length': 3.548051948051948, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1109593', 'n_tokens_mistral': 650, 'n_tokens_neox': 630, 'n_words': 133}