<commit_before>class Board < ActiveRecord::Base
  include Board::States

  acts_as_list :scope => :table

  %w[n e s w].each { |d| belongs_to "user_#{d}", :class_name => "User" }
  has_many :bids, :order => "bids.position", :extend => BidsBoardExtension
  has_many :cards, :order => "cards.position", :extend => CardsBoardExtension
  has_many :claims
  belongs_to :table, :touch => true

  validates :deal_id, :presence => true
  validates :dealer, :presence => true, :inclusion => Bridge::DIRECTIONS
  validates :vulnerable, :presence => true, :inclusion => Bridge::VULNERABILITIES

  scope :auction, where(:state => "auction")
  scope :playing, where(:state => "playing")
  scope :completed, where(:state => "completed")

  delegate :n, :e, :s, :w, :owner, :cards_for, :hcp, :to => :deal, :prefix => true, :allow_nil => true
  delegate :create_board!, :to => :table, :prefix => true, :allow_nil => true

  %w[n e s w].each do |d|
    define_method("user_#{d}_with_direction") do
      user_n_without_direction.tap do |user|
        user && user.define_singleton_method("direction") { d.upcase }
      end
    end
    alias_method_chain "user_#{d}", :direction
  end

  def deal
    Bridge::Deal.from_id(deal_id.to_i)
  rescue ArgumentError
  end

  def dealer_number
    Bridge::DIRECTIONS.index(dealer)
  end

  def contract_trump
    contract_without_modifier.try(:trump)
  end

  def contract_suit
    contract_without_modifier.try(:suit)
  end<commit_msg>reformatted code<commit_after>class Board < ActiveRecord::Base
  include Board::States

  acts_as_list :scope => :table

  %w[n e s w].each { |d| belongs_to "user_#{d}", :class_name => "User" }
  has_many :bids, :order => "bids.position", :extend => BidsBoardExtension
  has_many :cards, :order => "cards.position", :extend => CardsBoardExtension
  has_many :claims
  belongs_to :table, :touch => true

  validates :deal_id, :presence => true
  validates :dealer, :presence => true, :inclusion => Bridge::DIRECTIONS
  validates :vulnerable, :presence => true, :inclusion => Bridge::VULNERABILITIES

  scope :auction, where(:state => "auction")
  scope :playing, where(:state => "playing")
  scope :completed, where(:state => "completed")

  delegate :n, :e, :s, :w, :owner, :cards_for, :hcp, :to => :deal, :prefix => true, :allow_nil => true
  delegate :create_board!, :to => :table, :prefix => true, :allow_nil => true

  %w[n e s w].each do |d|
    define_method("user_#{d}_with_direction") do
      user_n_without_direction.tap do |user|
        user && user.define_singleton_method(:direction) { d.upcase }
      end
    end
    alias_method_chain "user_#{d}", :direction
  end

  def deal
    Bridge::Deal.from_id(deal_id.to_i)
  rescue ArgumentError
  end

  def dealer_number
    Bridge::DIRECTIONS.index(dealer)
  end

  def contract_trump
    contract_without_modifier.try(:trump)
  end

  def contract_suit
    contract_without_modifier.try(:suit)
  end
{'fraction_non_alphanumeric': 0.14192886456908343, 'fraction_numerical': 0.0, 'mean_word_length': 4.376838235294118, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '1504516', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1009, 'n_words': 246}