From 4178466733c5137f57403cff236bf0d470552f8f Mon Sep 17 00:00:00 2001 From: Siva Gollapalli Date: Fri, 2 Jan 2015 20:39:57 +0530 Subject: [PATCH] FIX# Warnings of uninitialize variables --- lib/v8/weak.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/v8/weak.rb b/lib/v8/weak.rb index 46147980..962cdc56 100644 --- a/lib/v8/weak.rb +++ b/lib/v8/weak.rb @@ -46,14 +46,14 @@ def []=(key, value) module Cell def weakcell(name, &block) - unless storage = instance_variable_get("@#{name}") + unless storage = instance_variable_defined?("@#{name}") ? instance_variable_get("@#{name}") : nil storage = instance_variable_set("@#{name}", Storage.new) end storage.access(&block) end class Storage def access(&block) - if @ref + if instance_variable_defined?(:@ref) @ref.object || populate(block) else populate(block) @@ -70,4 +70,4 @@ def populate(block) end end end -end \ No newline at end of file +end