aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/template_handler.rb')
-rw-r--r--actionpack/lib/action_view/template_handler.rb26
1 files changed, 23 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/template_handler.rb b/actionpack/lib/action_view/template_handler.rb
index d7e7c9b199..672da0ed2b 100644
--- a/actionpack/lib/action_view/template_handler.rb
+++ b/actionpack/lib/action_view/template_handler.rb
@@ -1,14 +1,34 @@
# Legacy TemplateHandler stub
-
module ActionView
- module TemplateHandlers
+ 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