aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template_handler.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-11-23 13:57:01 -0600
committerJoshua Peek <josh@joshpeek.com>2008-11-23 13:57:01 -0600
commitbc4d05b244c78f03ade51d8b95f16dd48ceb63d3 (patch)
treef261b5cc22a91ad39e415d31ccbdc98fd3a5e438 /actionpack/lib/action_view/template_handler.rb
parent2c01f2b4e9d4a95bb2baca8ae57209eb10aa78b2 (diff)
downloadrails-bc4d05b244c78f03ade51d8b95f16dd48ceb63d3.tar.gz
rails-bc4d05b244c78f03ade51d8b95f16dd48ceb63d3.tar.bz2
rails-bc4d05b244c78f03ade51d8b95f16dd48ceb63d3.zip
A back support for legacy TemplateHandler#render API
Diffstat (limited to 'actionpack/lib/action_view/template_handler.rb')
-rw-r--r--actionpack/lib/action_view/template_handler.rb29
1 files changed, 27 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/template_handler.rb b/actionpack/lib/action_view/template_handler.rb
index 5efe9459b5..672da0ed2b 100644
--- a/actionpack/lib/action_view/template_handler.rb
+++ b/actionpack/lib/action_view/template_handler.rb
@@ -1,9 +1,34 @@
# Legacy TemplateHandler stub
-
module ActionView
+ module TemplateHandlers #:nodoc:
+ module Compilable
+ def self.included(base)
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods
+ def call(template)
+ new.compile(template)
+ end
+ end
+
+ def compile(template)
+ raise "Need to implement #{self.class.name}#compile(template)"
+ end
+ end
+ end
+
class TemplateHandler
def self.call(template)
- new.compile(template)
+ "#{name}.new(self).render(template, local_assigns)"
+ end
+
+ def initialize(view = nil)
+ @view = view
+ end
+
+ def render(template, local_assigns)
+ raise "Need to implement #{self.class.name}#render(template, local_assigns)"
end
end
end