Sha256: 98bbfa6cd89f9002e1996eb053f579bb2331f987433ba84eca8df72d73494485
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
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 game @parser_class.game [/[^\n]+/] 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pokerstats-2.0.10 | lib/pokerstats/hand_history.rb |
pokerstats-2.0.9 | lib/pokerstats/hand_history.rb |
pokerstats-2.0.8 | lib/pokerstats/hand_history.rb |