diviner 0.1.4 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e98decf7df292d231ca16437211acfbbd0cf10c
4
- data.tar.gz: 969aacd0dae4130dfba6400630477910524b7c09
3
+ metadata.gz: 6be5f55fb880e569f6dfc5689900da4bbe45ba41
4
+ data.tar.gz: 5cb2a6530009f792a5ae4aeacfc56aace3094975
5
5
  SHA512:
6
- metadata.gz: a5d82251945d1635801052e9a2b0c38dc85f9d5cfacea190561f1223f78b9a86dd228e68378a4abd239f89576a1d3d63672258c6ed3cc7f716abec6b017a5723
7
- data.tar.gz: 0cc2004bc77123a75ec66826309e6e8ce95cce9c1096b06f5c70395fbcbcb82601a7bef7ea88ceb4c3673ca8578d930bc2c72ad351128e204127c4f097b8d008
6
+ metadata.gz: b8b5e4425700763d7e1902b1c46df05c90b94d8fc31615c606b1ba5a0fda6686a027b4eb0a16c43ada4cd88fa00d8310569e5b67c11f00d804ba070f410a91a0
7
+ data.tar.gz: f540da2126116b846188a4d3d77211a505482623e5863093c1bb6720cb7ecbd798264dca19fcad689522dd7ad47d9e43b34756e42484b5be046498f0aa6d70e0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.2.0
data/diviner.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: diviner 0.1.4 ruby lib
5
+ # stub: diviner 0.2.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "diviner"
9
- s.version = "0.1.4"
9
+ s.version = "0.2.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
data/lib/deviner/match.rb CHANGED
@@ -47,6 +47,8 @@ module Deviner
47
47
  clear_cache
48
48
  end
49
49
 
50
+
51
+ # Return nil if no matches found
50
52
  def match(categories)
51
53
  result = []
52
54
  for category in categories
@@ -56,13 +58,14 @@ module Deviner
56
58
 
57
59
  highest_value = result.map{|x| x[:value]}.sort.last
58
60
  selected_category = nil
59
- result.each do |hash|
60
- if hash[:value] == highest_value
61
- selected_category = hash[:category]
61
+ if highest_value > 0
62
+ result.each do |hash|
63
+ if hash[:value] == highest_value
64
+ selected_category = hash[:category]
65
+ end
62
66
  end
63
67
  end
64
68
 
65
- result = result.reject{ |x| x[:value] != highest_value}
66
69
  return selected_category
67
70
 
68
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diviner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferhat Ziba