Project

General

Profile

Actions

Bug #1751

closed

ReportCommon#status fails on ruby 1.9

Added by Shahar Mintz almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

In ruby 1.9 the method each doesn't works for String type.

A suggested fix:

diff --git a/app/models/report_common.rb b/app/models/report_common.rb
index a879a01..45af2fc 100644
--- a/app/models/report_common.rb
+++ b/app/models/report_common.rb
@@ -43,7 +43,13 @@ module ReportCommon
   def status(type = nil)
     raise "invalid type #{type}" if type and not METRIC.include?(type)
     h = {}
-    (type || METRIC).each do |m|
+    arr = []
+    if type == nil
+      arr = METRIC
+    else
+      arr << type
+    end
+    arr.each do |m|
       h[m] = (read_attribute(self.class.report_status) || 0) >> (BIT_NUM*METRIC.index(m)) & MAX
     end
     type.nil? ? h : h[type]
Actions #1

Updated by Ohad Levy almost 12 years ago

  • Assignee set to Ohad Levy
  • Target version set to 1.0
Actions #2

Updated by Ohad Levy almost 12 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF