-require "manifest/controller/list"
-require "manifest/controller/show"
+require_dependency "manifest/controller/action"
module Manifest
class Controller
include ControllerModule
end
attr :manifest, :controller_name, :controller_manifest, :item_name, :actions
- @@types = {'list' => ActionList, 'show' => ActionShow}
def initialize manifest, controller_name, controller_manifest
@manifest = manifest
@controller_name = controller_name
@item_name = @controller_manifest['item_name']
@actions = {}
@controller_manifest['actions'].each {|action_name, action_manifest|
- raise "undefined class for controllers > #{@controller_name} > actions > #{action_name} > type > #{action_manifest['type']}\n" unless @@types[action_manifest['type']]
- @actions[action_name] = @@types[action_manifest['type']].new(self, action_name, action_manifest)
+ @actions[action_name] = ActionFactory.factory self, action_name, action_manifest
}
end