OSDN Git Service

separate manifest
[pettanr/pettanr.git] / lib / locmare / profiler.rb
1 require_dependency "locmare/profiler/header"
2 require_dependency "locmare/profiler/column"
3 require_dependency "locmare/profiler/association"
4 module Locmare
5   class Profiler
6     include ProfilerModule
7     attr :profiler_manifest, :item_name, :item, :operators, :template_dir, 
8       :header, :columns, :associations
9     def initialize item_name, item, operators
10       @item_name = item_name
11       @item = item
12       @operators = operators
13       @profiler_manifest = LocalManifest.manifest.profilers[@item_name]
14       @template_dir = 'templates/r/profiler/'
15       @header = Header.new self
16       @columns = @profiler_manifest.column_names.map {|column_name|
17         Column.new self, column_name
18       }
19       @associations = Association.new self, @profiler_manifest.associations
20     end
21     
22     def model
23       ::Manifest::item_name_to_model @item_name
24     end
25     
26     def template_file_name
27       "profiler"
28     end
29     
30     def template_name
31       self.template_dir + self.template_file_name
32     end
33     
34     def header_template_file_name
35       "header"
36     end
37     
38     def header_template_name
39       self.template_dir + self.header_template_file_name
40     end
41     
42     def columns_template_file_name
43       "columns"
44     end
45     
46     def columns_template_name
47       self.template_dir + self.columns_template_file_name
48     end
49     
50     def associations_template_file_name
51       "associations"
52     end
53     
54     def associations_template_name
55       self.template_dir + self.associations_template_file_name
56     end
57     
58     def image_dir
59       '/images/'
60     end
61     
62   end
63 end
64