Commits

Kaspar Schiess committed 14e4f12

Cached result

Comments (0)

Files changed (1)

lib/iscsi/context.rb

             klass.new(self, node) } }
       end
       define_method cached_command do
-        parser = HashParser.new
-        parser.parse runner.shell(command)
+        variable_name = "@#{cached_command}"
+        instance_variable_get(variable_name) || 
+          instance_variable_set(variable_name, begin
+            parser = HashParser.new
+            parser.parse runner.shell(command)
+          end )
       end
     end