OSDN Git Service

fix update
[pettanr/pettanr.git] / lib / manifest / item / base.rb
index c48cf98..27e10b3 100644 (file)
@@ -5,7 +5,7 @@ module Manifest
   module ItemModule
     class BasePeta < ManifestBase::TypeNameArgs
       
-      attr :boost
+      attr :boost ,:parent_model_name
       
       def set_default
         super
@@ -14,18 +14,32 @@ module Manifest
       
       def init
         super
+        @parent_model_name = nil  # init at leaf, element
         @boost = ManifestBase.load_name_values self, @args, 'boost', Boost
       end
       
+      def init_after_load_manifest
+        @boost.each do |boost_name, boost_manifest|
+          boost_manifest.init_after_load_manifest
+        end
+      end
+      
       def element?
         @parent_model_name != nil
       end
       
-      def boosts item, level
-        @boost.each do |name, manifest|
-          next unless manifest.level == level
-          Boost::ItemBooster.new(manifest, item).boost
+      def find_boost_name column_name
+        @boost.each do |boost_name, boost_manifest|
+          return boost_name if boost_manifest.settings_column_name == column_name
         end
+        nil
+      end
+      
+      def extend_column? column_name
+        @boost.each do |boost_name, boost_manifest|
+          return true if boost_manifest.extend_column_name == column_name
+        end
+        false
       end
       
       def supply_defaults item
@@ -34,8 +48,14 @@ module Manifest
         end
       end
       
+      def overwrites item
+        @boost.each do |name, manifest|
+          manifest.overwrite item
+        end
+      end
+      
       def model
-        ::Manifest.manifest.models[@name]
+        ::Manifest.item_name_to_model @name
       end
       
     end