Sha256: 7aba33ce92c87985bb924ffe9add819df9212e00c72c53de17c042ba65dcb8ed

Contents?: true

Size: 892 Bytes

Versions: 19

Compression:

Stored size: 892 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + "/hand_constants")
require File.expand_path(File.dirname(__FILE__) + "/pokerstars_hand_history_parser")
class HandHistory
  attr_accessor :lines, :source, :position, :stats
  def initialize lines, source, position, parser_class = PokerstarsHandHistoryParser
    @lines = lines
    @source = source
    @position = position
    @parsed = false
    @parser_class = parser_class
    @stats = HandStatistics.new
  end
  
  def parsed?
    @parsed
  end
  
  def parse
    @parser = @parser_class.new(@stats)
    @lines.each do |each_line| 
      begin
        @parser.parse(each_line)
      rescue => e
        raise "#{@source}:#{position}: #{e.message}"
      end
    end
    @stats.update_hand :session_filename => source, :starting_at => position
    @parsed = true
  end
  
  def reports
    parse unless parsed?
    @stats.reports
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
wizardwerdna-pokerstats-0.4.0 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-0.5.0 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-0.6.0 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-0.7.0 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-0.8.0 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-0.8.1 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-0.8.2 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-0.9.0 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.0 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.10 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.11 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.12 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.13 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.14 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.2 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.5 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.6 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.7 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.9 lib/pokerstats/hand_history.rb