提交 b76b9e21 编写于 作者: J Jon Leighton

Simplify Relation#inspect

上级 8a6780bd
......@@ -515,19 +515,10 @@ def values
end
def inspect
text = if limit_value && limit_value <= 10
to_a.inspect
else
entries = limit(11).to_a
if entries.size > 10
entries.pop
"[#{entries.map(&:inspect).join(', ')}, ...]"
else
entries.inspect
end
end
entries = limit([limit_value, 11].compact.min).map(&:inspect)
entries[10] = '...' if entries.size == 11
"#<#{self.class.name} #{text}>"
"#<#{self.class.name} [#{entries.join(', ')}]>"
end
private
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册