Project

General

Profile

Actions

Feature #12161

closed

Friendly BigDecimal#inspect

Added by printercu (Max Melentiev) about 8 years ago. Updated over 7 years ago.

Status:
Closed
Target version:
-
[ruby-core:74241]

Description

Can BigDecimal's #inspect be more human-friendly? Even just #<BigDecimal:b7ea1130,1234.5678,8(12)> instead of #<BigDecimal:b7ea1130,'0.12345678E4',8(12)> will be much easy to read. But I think the best option is 1234.5678(#<BigDecimal:b7ea1130,8(12)>) or something alike, which focuses on its numeric nature.

I've never used bigdecimal's address and number of significant digits. Maybe if this is rarely used information it can be avoided in #inspect at all.

With such formatting It'll be easier to recognise values in repl, debugger, and especially in test's output/failures.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0