Project

General

Profile

Actions

Defect #38145

closed

Unreachable branch in ApplicationHelper#format_object due to the use of the deprecated Fixnum class

Added by Go MAEDA over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

There is an unreachable branch in ApplicationHelper#format_object. This is because a deprecated class name `Fixnum` is given to the `when` keyword.

Reference:
Unify Fixnum and Bignum into Integer
https://bugs.ruby-lang.org/issues/12005

While the branch is unreachable, fortunately, the result of the code below `when 'Fixnum'` is the same as the result of the code for the unknown class below `else`, so no problem is occurring for now.

The following patch fixes the issue.

Index: app/helpers/application_helper.rb
===================================================================
--- app/helpers/application_helper.rb    (revision 22022)
+++ app/helpers/application_helper.rb    (working copy)
@@ -263,7 +263,7 @@
       format_time(object)
     when 'Date'
       format_date(object)
-    when 'Fixnum'
+    when 'Integer'
       object.to_s
     when 'Float'
       sprintf "%.2f", object
</diff>

Files

38145.patch (1.62 KB) 38145.patch Go MAEDA, 2023-01-08 09:37
38145-v2.patch (1.61 KB) 38145-v2.patch Go MAEDA, 2023-01-11 15:43
Actions

Also available in: Atom PDF