From: "osyo (manga osyo)" Date: 2022-10-10T08:49:02+00:00 Subject: [ruby-core:110244] [Ruby master Feature#19045] [Proposal] Add support Data#pretty_print Issue #19045 has been updated by osyo (manga osyo). nobu (Nobuyoshi Nakada) wrote in #note-2: > Since `pp.rb` is a part of a default gem now, you have to consider the compatibility with older versions. Thanks. I've tried to fix it, but what do you think. https://github.com/ruby/ruby/pull/6521/commits/b322ba67548d0068894cc198ee073ad2ec0c7c51 ---------------------------------------- Feature #19045: [Proposal] Add support Data#pretty_print https://bugs.ruby-lang.org/issues/19045#change-99529 * Author: osyo (manga osyo) * Status: Open * Priority: Normal ---------------------------------------- While trying out the `Data` library I noticed that `Data#pretty_print` is not supported. `Data#inspect` included members, but `Data#pretty_print` does not. ```ruby require "pp" D = Data.define(:hoge, :foo, :bar) data = D.new("hoge", "foo", "bar") # Members is included puts data.inspect # => # # Members is not included puts PP.pp(data, "") # => # ``` Since `Struct#pretty_print` is supported, why not support `Data#pretty_print` as well. ```ruby require "pp" S = Struct.new(:hoge, :foo, :bar) str = S.new("hoge", "foo", "bar") # Supported Struct#pretty_print puts PP.pp(str, "", 20) # => # ``` PR: https://github.com/ruby/ruby/pull/6521 Sample: ```ruby D = Data.define(:hoge, :foo, :bar) data = D.new("hoge", "foo", "bar") puts PP.pp(data, "", 20) # => # ``` -- https://bugs.ruby-lang.org/ Unsubscribe: