OSDN Git Service

fix extend
[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       # feasible show parsed extend data
14       @item.boost 'post'
15       
16       @profiler_manifest = LocalManifest.manifest.profilers[@item_name]
17       @template_dir = 'templates/r/profiler/'
18       @header = Header.new self
19       @columns = @profiler_manifest.column_names.map {|column_name|
20         Column.new self, column_name
21       }
22       @associations = Association.new self, @profiler_manifest.associations
23     end
24     
25     def model
26       ::Manifest::item_name_to_model @item_name
27     end
28     
29     def template_file_name
30       "profiler"
31     end
32     
33     def template_name
34       self.template_dir + self.template_file_name
35     end
36     
37     def header_template_file_name
38       "header"
39     end
40     
41     def header_template_name
42       self.template_dir + self.header_template_file_name
43     end
44     
45     def columns_template_file_name
46       "columns"
47     end
48     
49     def columns_template_name
50       self.template_dir + self.columns_template_file_name
51     end
52     
53     def associations_template_file_name
54       "associations"
55     end
56     
57     def associations_template_name
58       self.template_dir + self.associations_template_file_name
59     end
60     
61     def image_dir
62       '/images/'
63     end
64     
65   end
66 end
67