Sha256: 75de0a8db7b520a5b68fd4d9f9aef1049ed0fd4ce587b506ada6a117c932e9fa

Contents?: true

Size: 975 Bytes

Versions: 9

Compression:

Stored size: 975 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + "/hand_constants")
require File.expand_path(File.dirname(__FILE__) + "/pokerstars_hand_history_parser")

module Pokerstats
  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
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
wizardwerdna-pokerstats-1.0.15 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.16 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.17 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.18 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.19 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-1.0.22 lib/pokerstats/hand_history.rb
wizardwerdna-pokerstats-2.0.0 lib/pokerstats/hand_history.rb
pokerstats-2.0.2 lib/pokerstats/hand_history.rb
pokerstats-2.0.1 lib/pokerstats/hand_history.rb