JoshCheek / seeing_is_believing

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

Multiple inspects #145

Open JoshCheek opened 5 years ago

JoshCheek commented 5 years ago

In xmpfilter mode, when there are multiple output locations, it inspects multiple times. Not sure this is worth caring about:

require 'bigdecimal'  # => true

public def usd; BigDecimal self end
public def inr; BigDecimal(self) / 70 end
class BigDecimal
  def inspect
    sprintf("$%.2f", self).sub(/\d+/) {
      $& # => "1234", "1234"
    }
  end
end
n = BigDecimal '1234.56' # => $1234.56
# => $1234.56
JoshCheek commented 5 years ago

Simpler example:

s = ""
def s.inspect
  "s" # => "s", "s"
end
s # => s
# => s