1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

avoid dup on the UNDUP-able without rescue.

This commit is contained in:
Robert Gleeson 2014-02-04 21:40:34 +01:00
parent a8156cbdc8
commit 95d9d9a054

View file

@ -1,6 +1,7 @@
class Pry
class Command::WatchExpression
class Expression
NODUP = [TrueClass, FalseClass, NilClass, Numeric].freeze
attr_reader :target, :source, :value, :previous_value
def initialize(target, source)
@ -11,10 +12,7 @@ class Pry
def eval!
@previous_value = value
@value = target_eval(target, source)
begin
@value = @value.dup
rescue Pry::RescuableException
end
@value = @value.dup unless NODUP.any? { |klass| klass === @value }
end
def to_s