Tag: 输出

如何使Irb不打印对象属性

我想irb默认不打印我的对象属性。 那可能吗? 例如,我有: class Test @tmp = nil def initialize(str) @tmp = str self end end 我得到: irb> t = Test.new(“hello”) => # 我不想看到@tmp=”hello”部分。