Commits

Kaspar Schiess  committed 14e4f12

Cached result

  • Participants
  • Parent commits 586f0d4

Comments (0)

Files changed (1)

File 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