OSDN Git Service

diet manifest
[pettanr/pettanr.git] / lib / manifest / profiler.rb
index 7ab98ba..d58dab3 100644 (file)
@@ -4,15 +4,16 @@ require_dependency "manifest/profiler/association"
 module Manifest
   class Profiler
     
-    include ProfilerModule
     def self.manager manifest, my_manifests
-      my_manifests.map {|item_name, profiler_manifest|
-        self.new(manifest, item_name, profiler_manifest)
+      profilers = {}
+      my_manifests.each {|item_name, profiler_manifest|
+        profilers[item_name] = self.new(manifest, item_name, profiler_manifest)
       }
+      profilers
     end
     
     attr :profiler_manifest, :item_name, :manifest, 
-      :columns, :lists, :associations
+      :column_names, :lists, :associations
     def initialize manifest, item_name, profiler_manifest
       @manifest = manifest
       @item_name = item_name
@@ -22,22 +23,22 @@ module Manifest
     end
     
     def set_default
-      @profiler_manifest['columns'] ||= []
+      @profiler_manifest['column_names'] ||= []
       @profiler_manifest['lists'] ||= {}
       @profiler_manifest['associations'] ||= {}
     end
     
     def init
-      @columns = @profiler_manifest['columns']
+      @column_names = ['id'] + @profiler_manifest['column_names'] + ['created_at', 'updated_at']
       @lists = {}
       @profiler_manifest['lists'].each {|list_name, list_manifest|
-        @lists[list_name] = List.new(self, list_name, list_manifest)
+        @lists[list_name] = ProfilerModule::List.new(self, list_name, list_manifest)
       }
-      @associations = Association.new(self, @profiler_manifest['associations'])
+      @associations = ProfilerModule::Association.new(self, @profiler_manifest['associations'])
     end
     
-    def open item, operators
-      ProfilerView.new @item_name, item, operators, @profiler_conf, @manifest
+    def each_column
+      @column_names
     end
     
   end