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:
parent
a8156cbdc8
commit
95d9d9a054
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue