From: "osyo (manga osyo)" Date: 2022-10-15T15:13:25+00:00 Subject: [ruby-core:110314] [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-4: > `"3.2" <= RUBY_VERSION` won't work when `RUBY_VERSION` is "3.10", but probably never. > And it is needed in the test. > Can't you send the PR to ruby/pp, so it will be tested with older versions? Sorry for the delay in replying. Thank you. ---------------------------------------- Feature #19045: [Proposal] Add support Data#pretty_print https://bugs.ruby-lang.org/issues/19045#change-99604 * Author: osyo (manga osyo) * Status: Closed * 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: