Project

General

Profile

Actions

Bug #20808

open

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

Added by maicolben (Maicol Bentancor) 14 days ago. Updated 14 days ago.

Status:
Open
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
Like1Like0Like1Like0Like0Like0