JoshCheek / seeing_is_believing

Displays the results of every line of code in your file
1.3k stars 54 forks source link

Let errors in inspect raise #159

Open JoshCheek opened 3 years ago

JoshCheek commented 3 years ago
class A
  def initialize(x, y)
    @x, @y = x, y
  end

  # What user intended:
  def inspect
    "#{self.class}.new(#{@x}, #{@y})"
  end
  new 123, 456 # => A.new(123, 456)

  # What user did, SiB hides this, which, in practice, has never been what I've
  # wanted it to do over 10 years or so... soooooo let the error raise?!
  def inspect
    "#{self.class}.new(#{x}, #{y})"
  end
  new 123, 456 # => #<A:0x00000001428bb4e0 @x=123, @y=456>
end