From: "nobu (Nobuyoshi Nakada)" Date: 2022-10-10T07:46:45+00:00 Subject: [ruby-core:110243] [Ruby master Feature#19045] [Proposal] Add support Data#pretty_print Issue #19045 has been updated by nobu (Nobuyoshi Nakada). Since `pp.rb` is a part of a default gem now, you have to consider the compatibility with older versions. ---------------------------------------- Feature #19045: [Proposal] Add support Data#pretty_print https://bugs.ruby-lang.org/issues/19045#change-99528 * 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: