pokerstats 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.4
1
+ 2.0.5
@@ -25,7 +25,7 @@ module Pokerstats
25
25
  ##
26
26
 
27
27
  def hand_record
28
- raise "#{HAND_RECORD_INCOMPLETE_MESSAGE}: #{(HAND_INFORMATION_KEYS - @hand_information.keys).inspect}" unless (HAND_INFORMATION_KEYS - @hand_information.keys).empty?
28
+ raise Pokerstats::HandHistoryParseError, "#{HAND_RECORD_INCOMPLETE_MESSAGE}: #{(HAND_INFORMATION_KEYS - @hand_information.keys).inspect}" unless (HAND_INFORMATION_KEYS - @hand_information.keys).empty?
29
29
  HAND_INFORMATION_KEYS.inject({}) do |hash, key|
30
30
  hash.merge!(key => @hand_information[key])
31
31
  end
@@ -46,9 +46,9 @@ module Pokerstats
46
46
  end
47
47
 
48
48
  def player_records
49
- raise PLAYER_RECORDS_NO_PLAYER_REGISTERED if players.empty?
50
- raise PLAYER_RECORDS_NO_BUTTON_REGISTERED if button.nil?
51
- raise PLAYER_RECORDS_OUT_OF_BALANCE if out_of_balance
49
+ raise Pokerstats::HandHistoryParseError, PLAYER_RECORDS_NO_PLAYER_REGISTERED if players.empty?
50
+ raise Pokerstats::HandHistoryParseError, PLAYER_RECORDS_NO_BUTTON_REGISTERED if button.nil?
51
+ raise Pokerstats::HandHistoryParseError, PLAYER_RECORDS_OUT_OF_BALANCE if out_of_balance
52
52
  self.player_records_without_validation
53
53
  end
54
54
 
@@ -62,7 +62,7 @@ module Pokerstats
62
62
 
63
63
  def register_player player
64
64
  screen_name = player[:screen_name]
65
- raise "#{PLAYER_RECORDS_DUPLICATE_PLAYER_NAME}: #{screen_name.inspect}" if players.member?(screen_name)
65
+ raise Pokerstats::HandHistoryParseError, "#{PLAYER_RECORDS_DUPLICATE_PLAYER_NAME}: #{screen_name.inspect}" if players.member?(screen_name)
66
66
  @cached_player_position = nil
67
67
  @player_hashes << player
68
68
  plugins.each{|each| each.register_player(screen_name, @street_state)} #why the second parameter?
@@ -169,7 +169,7 @@ module Pokerstats
169
169
  end
170
170
 
171
171
  def register_action(screen_name, description, options={})
172
- raise "#{PLAYER_RECORDS_UNREGISTERED_PLAYER}: #{screen_name.inspect}" unless players.member?(screen_name)
172
+ raise Pokerstats::HandHistoryParseError, "#{PLAYER_RECORDS_UNREGISTERED_PLAYER}: #{screen_name.inspect}" unless players.member?(screen_name)
173
173
  plugins.each do |each|
174
174
  each.apply_action(
175
175
  {:screen_name => screen_name, :description => description, :aggression => aggression(description)}.update(options),
@@ -34,10 +34,10 @@ module Pokerstats
34
34
  @aggregate_statistics[each_player] ||= {}
35
35
 
36
36
  @aggregate_statistics[each_player][:t_hands] ||= 0
37
- @aggregate_statistics[each_player][:t_hands] += 1
38
- @aggregate_statistics[each_player][:t_vpip] ||= 0
39
- @aggregate_statistics[each_player][:t_vpip] += 1 unless reports[each_player][:paid].zero?
40
- aggregate_numeric_statistic each_player, reports, :t_posted, :posted
37
+ @aggregate_statistics[each_player][:t_hands] += 1
38
+ @aggregate_statistics[each_player][:t_vpip] ||= 0
39
+ @aggregate_statistics[each_player][:t_vpip] += 1 unless reports[each_player][:paid].zero?
40
+ aggregate_numeric_statistic each_player, reports, :t_posted, :posted
41
41
  aggregate_numeric_statistic each_player, reports, :t_paid, :paid
42
42
  aggregate_numeric_statistic each_player, reports, :t_won, :won
43
43
  aggregate_numeric_statistic each_player, reports, :t_preflop_passive, :preflop_passive
@@ -62,11 +62,11 @@ module Pokerstats
62
62
  def parse(line)
63
63
  case line
64
64
  when /PokerStars Game #([0-9]+): Tournament #([0-9]+), (\$[0-9+$]+) ([^\-]*) - Level ([IVXL]+) \((#{CASH})\/(#{CASH})\) - (.*)$/
65
- @stats.update_hand :name => "PS#{$1}", :description=> "#{$2}, #{$3} #{$4}", :tournament=> $2, :sb=> $6.to_d, :bb=> $7.to_d, :played_at=> Time.parse($8), :street => :prelude
65
+ @stats.update_hand :name => "PS#{$1}", :description=> "#{$2}, #{$3} #{$4}", :tournament=> $2, :sb=> $6.to_d, :bb=> $7.to_d, :played_at=> Time.parse($8), :street => :prelude, :board => ""
66
66
  when /PokerStars Game #([0-9]+): +([^(]*) \((#{CASH})\/(#{CASH})\) - (.*)$/
67
- @stats.update_hand :name => "PS#{$1}", :description=> "#{$2} (#{$3}/#{$4})", :tournament=> nil, :sb=> cash_to_d($3), :bb=> cash_to_d($4), :played_at=> Time.parse($5), :street => :prelude
67
+ @stats.update_hand :name => "PS#{$1}", :description=> "#{$2} (#{$3}/#{$4})", :tournament=> nil, :sb=> cash_to_d($3), :bb=> cash_to_d($4), :played_at=> Time.parse($5), :street => :prelude, :board => ""
68
68
  when /PokerStars Game #([0-9]+): +([^(]*) \((#{CASH})\/(#{CASH}) USD\) - (.*)$/
69
- @stats.update_hand :name => "PS#{$1}", :description=> "#{$2} (#{$3}/#{$4})", :tournament=> nil, :sb=> cash_to_d($3), :bb=> cash_to_d($4), :played_at=> Time.parse($5), :street => :prelude
69
+ @stats.update_hand :name => "PS#{$1}", :description=> "#{$2} (#{$3}/#{$4})", :tournament=> nil, :sb=> cash_to_d($3), :bb=> cash_to_d($4), :played_at=> Time.parse($5), :street => :prelude, :board => ""
70
70
  when /PokerStars Game #([0-9]+):/
71
71
  raise HandHistoryParseError, "invalid hand record: #{line}"
72
72
  when /\*\*\* HOLE CARDS \*\*\*/
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pokerstats}
8
- s.version = "2.0.4"
8
+ s.version = "2.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew C. Greenberg"]
@@ -38,10 +38,10 @@ describe PokerstarsHandHistoryParser, "when parsing structural matter" do
38
38
  :bb => "20".to_d,
39
39
  :played_at => Time.parse("2008/10/31 17:25:42 ET"),
40
40
  :tournament => "117620218",
41
- :street => :prelude
41
+ :street => :prelude,
42
+ :board => "" # due to pokerstars hand history bug (does not have Board record unless flop is seen)
42
43
  )
43
44
  @parser.parse("PokerStars Game #21650436825: Tournament #117620218, $10+$1 Hold'em No Limit - Level I (10/20) - 2008/10/31 17:25:42 ET")
44
- puts @stats.report_hand_information
45
45
  end
46
46
 
47
47
  it "should recognize a tournament header" do
@@ -56,7 +56,8 @@ describe PokerstarsHandHistoryParser, "when parsing structural matter" do
56
56
  :bb => "0.50".to_d,
57
57
  :played_at => Time.parse("2008/10/31 17:14:44 ET"),
58
58
  :tournament => nil,
59
- :street => :prelude
59
+ :street => :prelude,
60
+ :board => "" # due to pokerstars hand history bug
60
61
  )
61
62
  @parser.parse("PokerStars Game #21650146783: Hold'em No Limit ($0.25/$0.50) - 2008/10/31 17:14:44 ET")
62
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pokerstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew C. Greenberg