From 34308c41800a0ea9b02842c4cf84e8bcc5dd1f63 Mon Sep 17 00:00:00 2001 From: Paul Asmuth Date: Mon, 12 Mar 2012 21:27:58 +0100 Subject: [PATCH] native: better error handling & bump to 0.3.6 --- lib/recommendify/jaccard_input_matrix.rb | 9 ++++++--- recommendify.gemspec | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/recommendify/jaccard_input_matrix.rb b/lib/recommendify/jaccard_input_matrix.rb index c44d026..638ac59 100644 --- a/lib/recommendify/jaccard_input_matrix.rb +++ b/lib/recommendify/jaccard_input_matrix.rb @@ -38,9 +38,12 @@ def run_native(item_id) raise "error: dirty exit (#{$?})" if $? != 0 res.split("\n").map do |line| sim = line.match(/OUT: \(([^\)]*)\) \(([^\)]*)\)/) - raise "error: #{res}" if !sim && !(res||"").include?('exit:') - [sim[1], sim[2].to_f] - end + unless sim + raise "error: #{res}" unless (res||"").include?('exit:') + else + [sim[1], sim[2].to_f] + end + end.compact end def check_native diff --git a/recommendify.gemspec b/recommendify.gemspec index ef70a53..f6b5ee9 100644 --- a/recommendify.gemspec +++ b/recommendify.gemspec @@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__) Gem::Specification.new do |s| s.name = "recommendify" - s.version = "0.3.5" + s.version = "0.3.6" s.date = Date.today.to_s s.platform = Gem::Platform::RUBY s.authors = ["Paul Asmuth"]