Project

General

Profile

Bug #1751

ReportCommon#status fails on ruby 1.9

Added by Shahar Mintz about 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
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]

Associated revisions

Revision 249afd9c (diff)
Added by Ohad Levy about 7 years ago

fixes #1751 - ReportCommon#status fails on ruby 1.9

History

#1 Updated by Ohad Levy about 7 years ago

  • Assignee set to Ohad Levy
  • Target version set to 1.0

#2 Updated by Ohad Levy about 7 years ago

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

Also available in: Atom PDF