Commits

Kaspar Schiess committed 49a9eb2

Cache ids in context

Comments (0)

Files changed (1)

lib/iscsi/context.rb

       def access id, &producer
         @map[id] || @map[id]=producer.call
       end
+      def ids
+        @map.keys
+      end
     end
     
     attr_reader :runner
         find { |t| t.name == name }
     end
     def targets
-      ArrayEnum.new(stmf_targets) { |node| 
+      target_ids = cat(:target).ids || ArrayEnum.new(stmf_targets)
+      target_ids.each { |node| 
         cat(:target).access(node.value) { Target.new(self, node) } }
     end
     def stmf_targets