wizardwerdna-pokerstats 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/pokerstats/hand_constants.rb +15 -2
- data/lib/pokerstats/hand_statistics.rb +31 -5
- data/pokerstats.gemspec +2 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.1
|
@@ -1,6 +1,19 @@
|
|
1
1
|
module HandConstants
|
2
|
-
|
3
|
-
|
2
|
+
HAND_REPORT_SPECIFICATION = [
|
3
|
+
# [key, sql_type, function]
|
4
|
+
[:session_filename, 'string'],
|
5
|
+
[:starting_at, 'datetime'],
|
6
|
+
[:name, 'string'],
|
7
|
+
[:description, 'string'],
|
8
|
+
[:sb, 'decimal'],
|
9
|
+
[:bb, 'decimal'],
|
10
|
+
[:board, 'string'],
|
11
|
+
[:total_pot, 'decimal'],
|
12
|
+
[:rake, 'decimal'],
|
13
|
+
[:played_at, 'datetime'],
|
14
|
+
[:tournament, 'string']
|
15
|
+
]
|
16
|
+
HAND_INFORMATION_KEYS = HAND_REPORT_SPECIFICATION.map{|each| each.first}
|
4
17
|
HAND_RECORD_INCOMPLETE_MESSAGE = "hand record is incomplete"
|
5
18
|
PLAYER_RECORDS_NO_PLAYER_REGISTERED = "no players have been registered"
|
6
19
|
PLAYER_RECORDS_DUPLICATE_PLAYER_NAME = "player screen_name has been registered twice"
|
@@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/hand_statistics_api')
|
|
5
5
|
|
6
6
|
class HandStatistics
|
7
7
|
include Pluggable
|
8
|
+
include HandConstants
|
8
9
|
plugin_include_module HandStatisticsAPI
|
9
10
|
def initialize
|
10
11
|
install_plugins self
|
@@ -195,29 +196,54 @@ class HandStatistics
|
|
195
196
|
prefix = <<-PREFIX
|
196
197
|
class AddHandStatisticsForPlayer < ActiveRecord::Migration
|
197
198
|
def self.up
|
198
|
-
create_table :
|
199
|
-
t.integer :
|
199
|
+
create_table :hand_statistics_for_player do |t|
|
200
|
+
t.integer :hand_statistics_id
|
200
201
|
PREFIX
|
201
202
|
middle = plugin_factory.inject(""){|string, each| string + each.rails_migration_segment_for_player_data}
|
202
203
|
suffix = <<-SUFFIX
|
203
204
|
end
|
204
205
|
end
|
205
206
|
def self.down
|
206
|
-
drop_table :
|
207
|
+
drop_table :hand_statistics_for_player
|
207
208
|
end
|
208
209
|
end
|
209
210
|
SUFFIX
|
210
211
|
return prefix + middle + suffix
|
211
212
|
end
|
212
213
|
|
214
|
+
def self.rails_migration_segment_for_hand_data key, sql_type
|
215
|
+
"\t\tt.#{sql_type}\t#{key.inspect}\n"
|
216
|
+
end
|
217
|
+
|
218
|
+
def self.rails_migration_for_hand_data
|
219
|
+
prefix = <<-PREFIX
|
220
|
+
class AddHandStatistics < ActiveRecord::Migration
|
221
|
+
def self.up
|
222
|
+
create_table :hand_statistics do |t|
|
223
|
+
PREFIX
|
224
|
+
middle = HAND_REPORT_SPECIFICATION.inject(""){|string, each| string + rails_migration_segment_for_hand_data(*each)}
|
225
|
+
suffix = <<-SUFFIX
|
226
|
+
end
|
227
|
+
end
|
228
|
+
def self.down
|
229
|
+
drop_table :hand_statistics
|
230
|
+
end
|
231
|
+
end
|
232
|
+
SUFFIX
|
233
|
+
return prefix + middle + suffix
|
234
|
+
end
|
235
|
+
|
236
|
+
def self.rails_migration_data
|
237
|
+
rails_migration_for_hand_data + "\n\n" +
|
238
|
+
rails_migration_for_player_data
|
239
|
+
end
|
213
240
|
private
|
214
241
|
def method_missing symbol, *args
|
215
242
|
plugins.send symbol, *args
|
216
243
|
end
|
217
244
|
end
|
218
|
-
|
219
245
|
# Load Plugins and Delegate non-api public methods to plugins
|
220
246
|
Dir[File.dirname(__FILE__) + "/plugins/*_statistics.rb"].each {|filename| require File.expand_path(filename)}
|
221
247
|
HandStatistics.delegate_plugin_public_methods_except HandStatisticsAPI.public_methods
|
222
248
|
|
223
|
-
puts HandStatistics.
|
249
|
+
# puts HandStatistics.rails_migration_data
|
data/pokerstats.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pokerstats}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.1"
|
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"]
|
12
|
-
s.date = %q{2009-08-
|
12
|
+
s.date = %q{2009-08-22}
|
13
13
|
s.default_executable = %q{checkps}
|
14
14
|
s.description = %q{a library for extracting, computing and reporting statistics of poker hands parsed from hand history files}
|
15
15
|
s.email = %q{wizardwerdna@gmail.com}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wizardwerdna-pokerstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew C. Greenberg
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-22 00:00:00 -07:00
|
13
13
|
default_executable: checkps
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|