Skip to content

Conversation

@nevans
Copy link
Collaborator

@nevans nevans commented Nov 9, 2025

Viewing config objects in Irb was much too messy to easily inspect: it printed every attribute for each ancestor, and most of them would simply be the Net::IMAP::Config::AttrInheritance::INHERITED const, repeated over and over.

Now, Net::IMAP::Config#inspect only shows overridden (non-default) config attributes within the inheritance chain.

(Line breaks have been added to the example output for legibility.)

  Net::IMAP::Config.new(0.4)
    .new(open_timeout: 10, enforce_logindisabled: true)
    .inspect
  #=> "#<Net::IMAP::Config:0x0000745871125410 open_timeout=10 enforce_logindisabled=true
  #      inherits from Net::IMAP::Config[0.4]
  #      inherits from Net::IMAP::Config.global
  #      inherits from Net::IMAP::Config.default>"

  config = Net::IMAP::Config.global
    .new(open_timeout: 10, idle_response_timeout: 2)
    .new(enforce_logindisabled: :when_capabilities_cached, sasl_ir: false)
  config.inspect
  #=> "#<Net::IMAP::Config:0x00007ce2a1e20e40 sasl_ir=false enforce_logindisabled=:when_capabilities_cached
  #      inherits from Net::IMAP::Config:0x00007ce2a1e20f80 open_timeout=10 idle_response_timeout=2
  #      inherits from Net::IMAP::Config.global
  #      inherits from Net::IMAP::Config.default>"
      
  Net::IMAP.debug = true
  config.inspect
  #=> "#<Net::IMAP::Config:0x00007ce2a1e20e40 sasl_ir=false enforce_logindisabled=:when_capabilities_cached
  #      inherits from Net::IMAP::Config:0x00007ce2a1e20f80 open_timeout=10 idle_response_timeout=2
  #      inherits from Net::IMAP::Config.global debug=true
  #      inherits from Net::IMAP::Config.default>"

Viewing config objects in Irb was _much_ too messy to easily inspect: it
every attribute for each ancestor, and most of them would simply be the
Net::IMAP::Config::AttrInheritance::INHERITED const, repeated over and
over.

Now, `Net::IMAP::Config#inspect` only shows overridden config attributes
within the inheritance chain.
@nevans
Copy link
Collaborator Author

nevans commented Nov 9, 2025

@nevans nevans merged commit 6093acb into master Nov 9, 2025
25 of 32 checks passed
@nevans nevans deleted the config/inspect branch November 9, 2025 19:33
nevans added a commit that referenced this pull request Nov 9, 2025
Viewing config objects in Irb was _much_ too messy to easily inspect: it
printed every attribute for each ancestor, and most of them would simply
be the Net::IMAP::Config::AttrInheritance::INHERITED const, repeated
over and over.

So, just like `Config#inspect` was improved by #546, this simplifies the
`Kernel#pp` output to make it more useful for inspection on the console.

Unlike `Config#inspect`, `Config#pretty_print` prints _every_ config
attribute, including attributes that have been defined by a named
default config.  Like `Config#inspect`, each attributes is printed only
once, nested in the config which assigned it.
nevans added a commit that referenced this pull request Nov 9, 2025
Viewing config objects in Irb was _much_ too messy to easily inspect: it
printed every attribute for each ancestor, and most of them would simply
be the Net::IMAP::Config::AttrInheritance::INHERITED const, repeated
over and over.

So, just like `Config#inspect` was improved by #546, this simplifies the
`Kernel#pp` output to make it more useful for inspection on the console.

Unlike `Config#inspect`, `Config#pretty_print` prints _every_ config
attribute, including attributes that have been defined by a named
default config.  Like `Config#inspect`, each attributes is printed only
once, nested in the config which assigned it.
nevans added a commit that referenced this pull request Nov 9, 2025
Viewing config objects in Irb was _much_ too messy to easily inspect: it
printed every attribute for each ancestor, and most of them would simply
be the Net::IMAP::Config::AttrInheritance::INHERITED const, repeated
over and over.

So, just like `Config#inspect` was improved by #546, this simplifies the
`Kernel#pp` output to make it more useful for inspection on the console.

Unlike `Config#inspect`, `Config#pretty_print` prints _every_ config
attribute, including attributes that have been defined by a named
default config.  Like `Config#inspect`, each attributes is printed only
once, nested in the config which assigned it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants