Project

General

Profile

Actions

Bug #20808

closed

Data#pretty_print doesn't handle private or remove attribute readers

Added by maicolben (Maicol Bentancor) about 1 month ago. Updated 10 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:119575]

Description

Given the next code:

Dog = Data.define(:name) do
  def inspect
    "Hello!"
  end

  private
  attr_reader :name
end

Dog.new(name: "Fido")

It throws an error:

  • An error occurred when inspecting the object: #<NoMethodError: private method `name' called for an instance of Dog>

And isn't using my inspect function

Actions

Also available in: Atom PDF

Like0
Like1Like0Like1Like0Like0Like0Like0Like1Like1