diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-02-24 17:25:21 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-02-24 17:25:21 -0800 |
commit | b1f078bddfecd40cce47b7db738620f2df2219c9 (patch) | |
tree | be99345865c71cc37e920c87218972a33a24cfe7 /actionpack/lib | |
parent | d6b9f8410c990b3d68d1970f1461a1d385d098d7 (diff) | |
download | rails-b1f078bddfecd40cce47b7db738620f2df2219c9.tar.gz rails-b1f078bddfecd40cce47b7db738620f2df2219c9.tar.bz2 rails-b1f078bddfecd40cce47b7db738620f2df2219c9.zip |
First, very early, AbstractController code. More to come
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/abstract/base.rb | 23 | ||||
-rw-r--r-- | actionpack/lib/action_controller/abstract/renderer.rb | 25 | ||||
-rw-r--r-- | actionpack/lib/action_view/template/handlers/erb.rb | 2 |
3 files changed, 50 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/abstract/base.rb b/actionpack/lib/action_controller/abstract/base.rb new file mode 100644 index 0000000000..c139531956 --- /dev/null +++ b/actionpack/lib/action_controller/abstract/base.rb @@ -0,0 +1,23 @@ +module AbstractController + class Base + + attr_internal :response_body + attr_internal :response_obj + cattr_accessor :logger + + def self.process(action) + new.process(action) + end + + def initialize + self.response_obj = {} + end + + def process(action) + send(action) + self.response_obj[:body] = self.response_body + self + end + + end +end
\ No newline at end of file diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb new file mode 100644 index 0000000000..7999bc1b70 --- /dev/null +++ b/actionpack/lib/action_controller/abstract/renderer.rb @@ -0,0 +1,25 @@ +module AbstractController + module Renderer + + def self.included(klass) + klass.extend ClassMethods + klass.extlib_inheritable_accessor :view_paths + klass.view_paths ||= ActionView::PathSet.new + end + + def _action_view + @_action_view ||= ActionView::Base.new(self.class.view_paths, {}, self) + end + + def render(template) + tmp = view_paths.find_by_parts(template) + self.response_body = _action_view._render_template_with_layout(tmp) + end + + module ClassMethods + def append_view_path(path) + self.view_paths << path + end + end + end +end
\ No newline at end of file diff --git a/actionpack/lib/action_view/template/handlers/erb.rb b/actionpack/lib/action_view/template/handlers/erb.rb index e3120ba267..a20b1b0cd3 100644 --- a/actionpack/lib/action_view/template/handlers/erb.rb +++ b/actionpack/lib/action_view/template/handlers/erb.rb @@ -1,3 +1,5 @@ +require 'erb' + module ActionView module TemplateHandlers class ERB < TemplateHandler |