pcbr 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pcbr.rb +12 -7
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ffebfcba7efed840c175df7f5bbc937193421a9
4
- data.tar.gz: acee6ef464ff5ea9a4cbb2c09eb0786c11616b58
3
+ metadata.gz: b127520de97919ba1fbce82430bef9f29c872dd8
4
+ data.tar.gz: 4b33ca2aa2c600ca3fe419815fae79b52bfa20ea
5
5
  SHA512:
6
- metadata.gz: 939b2a03b5c31a7ab328b5e06a17400d5b7e04b84aa5bba88c81943fa9bd4370122352975131e19a794a1e1052abe7c02688d340846dc42067361eefb24dc016
7
- data.tar.gz: 32e71d883437a73ee6e3d5d9f7695b173a3024289e42892c2f020583d971e0a8b87d4ef8a48ca5a44b3f385e996c2d4bdd2a82085df30d73124183e3e586a07b
6
+ metadata.gz: c5e44fb084dad37cfe1c29e4cd9607372dc255f7895731f5bec3e4cbb24574f01dfea035c96b43db2bcac937301597b7b39f16910b98ba85f1e31629a31180cc
7
+ data.tar.gz: 5339d942aac5fc793bb6311a0d75001f359dd11b1d6ca4f03f5b28944bbded74c8b57f0704f426decfc0386ebded944ee34424e509d6aeed27f3c89f0007cb6d
@@ -1,6 +1,6 @@
1
1
  class PCBR
2
2
 
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
 
5
5
  attr_reader :table
6
6
 
@@ -13,16 +13,21 @@ class PCBR
13
13
  # @table.size
14
14
  # end
15
15
 
16
+ ARRAY_101 = [0, 0, 0]
16
17
  def store key, *vector
17
18
  vector = vector.empty? ? [key] : vector.first
18
19
  calculated = @callback[vector, key]
19
- score = @table.map do |item|
20
- calculated.zip(item[3]).map do |a, b|
21
- a <=> b
22
- end.uniq.inject(0, :+).tap do |point|
23
- item[2] -= point
20
+ score = 0
21
+ @table.each do |item|
22
+ array = ARRAY_101.dup
23
+ calculated.zip(item[3]).each do |a, b|
24
+ t = a <=> b
25
+ array[t] = t
24
26
  end
25
- end.inject 0, :+
27
+ point = array.inject :+
28
+ score += point
29
+ item[2] -= point
30
+ end
26
31
  @table.push [key, vector, score, calculated]
27
32
  end
28
33
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pcbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-29 00:00:00.000000000 Z
11
+ date: 2016-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,8 +72,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  requirements: []
74
74
  rubyforge_project:
75
- rubygems_version: 2.0.14.1
75
+ rubygems_version: 2.0.14
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: Pair Comparison Based Rating
79
79
  test_files: []
80
+ has_rdoc: