goldmine 1.1.2 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcc6c70aef70c015a20b523b734100d1311b6a74
4
- data.tar.gz: 3f21113f8d1fac514461b4e55256612e08ad4ad9
3
+ metadata.gz: c686bfb600cadea453033f457a751ce8538b00af
4
+ data.tar.gz: 1216c9ddd41197c6f25c1017039b0d2428a20105
5
5
  SHA512:
6
- metadata.gz: 527ce95854acbd18e9665a4f78b1b63a810e9be136c8100e9081f17c5b8d4cc7ebc078e62ccfda684c7662e79656d0c9c0ddf816497cb393f6b22e5218bfcd0f
7
- data.tar.gz: 8701ad56f3e65377c66bbfd0392bb206e1226db31211e571398d8dd7ea145cacfb2e45b970fc244d2ecddb1fcd58d0dced3a494393c360878a321e775c890703
6
+ metadata.gz: 3baf5482a83183114999ed3d705ff8c97b6bc5b0cb9a3ae02e64f0eb9af378ea8fc4a8e39e5003f6da9eb8fae275407bb541f6eb51880e886205a72843f7532e
7
+ data.tar.gz: acf22665e1acf226ef31274021da2ceb406ef3a268555abb7f597fccc3b08ba7290f81ef9789b684073455b4f9c316a0d889208375c240da57e34600c0a978fd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- goldmine (1.1.1)
4
+ goldmine (1.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -151,10 +151,10 @@ This feature is useful when you need to do things like export to CSV or build us
151
151
  mined.to_a
152
152
  # result:
153
153
  [
154
- ["Name has an 'e'", ">= 21 years old", "total"],
155
- [false, true, 2],
156
- [true, true, 2],
157
- [true, false, 1]
154
+ ["Name has an 'e'", ">= 21 years old", "Percent of Total", "Count"],
155
+ [false, true, 0.4, 2],
156
+ [true, true, 0.4, 2],
157
+ [true, false, 0.2, 1]
158
158
  ]
159
159
  ```
160
160
 
@@ -84,11 +84,12 @@ module Goldmine
84
84
  rows = map do |pair|
85
85
  [].tap do |row|
86
86
  row.concat pair.first.values
87
+ row << sprintf("%.2f", (pair.last.size / source_data.size.to_f)).to_f
87
88
  row << pair.last.size
88
89
  end
89
90
  end
90
91
  rows = rows.sort_by(&block) if block_given?
91
- header = pivoted_keys.map(&:to_s) << "total"
92
+ header = [pivoted_keys.map(&:to_s), "Percent of Total", "Count"].flatten
92
93
  rows.insert 0, header
93
94
  rows
94
95
  end
@@ -1,3 +1,3 @@
1
1
  module Goldmine
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.4"
3
3
  end
@@ -67,7 +67,7 @@ class TestGoldmine < PryTest::Test
67
67
  record[:age] >= 21
68
68
  end
69
69
 
70
- expected = [["Name has an 'e'", ">= 21 years old", "total"], [true, false, 1], [false, true, 2], [true, true, 2]]
70
+ expected = [["Name has an 'e'", ">= 21 years old", "Percent of Total", "Count"], [true, false, 0.2, 1], [false, true, 0.4, 2], [true, true, 0.4, 2]]
71
71
 
72
72
  # block is sort_by
73
73
  tabular_data = mined.to_a do |row|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goldmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins