Sha256: 064fe8fffcd7ce93cf34e43e5cd0b3c0b4b85cf2d68b46ed22faa9498e4a3625

Contents?: true

Size: 1.44 KB

Versions: 28

Compression:

Stored size: 1.44 KB

Contents

require 'action_dispatch/http/mime_type'
require 'active_support/core_ext/class/attribute'

# Legacy TemplateHandler stub
module ActionView
  class Template
    module Handlers #:nodoc:
      module Compilable
        def self.included(base)
          ActiveSupport::Deprecation.warn "Including Compilable in your template handler is deprecated. " <<
            "Since Rails 3, all the API your template handler needs to implement is to respond to #call."
          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 Template::Handler
      class_attribute :default_format
      self.default_format = Mime::HTML

      def self.inherited(base)
        ActiveSupport::Deprecation.warn "Inheriting from ActionView::Template::Handler is deprecated. " <<
          "Since Rails 3, all the API your template handler needs to implement is to respond to #call."
        super
      end

      def self.call(template)
        raise "Need to implement #{self.class.name}#call(template)"
      end

      def render(template, local_assigns)
        raise "Need to implement #{self.class.name}#render(template, local_assigns)"
      end
    end
  end

  TemplateHandlers = Template::Handlers
  TemplateHandler = Template::Handler
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
actionpack-3.1.12 lib/action_view/template/handler.rb
actionpack-3.1.11 lib/action_view/template/handler.rb
actionpack-3.1.10 lib/action_view/template/handler.rb
actionpack-3.1.9 lib/action_view/template/handler.rb
actionpack-3.1.8 lib/action_view/template/handler.rb
actionpack-3.1.7 lib/action_view/template/handler.rb
actionpack-3.1.6 lib/action_view/template/handler.rb
actionpack-3.1.5 lib/action_view/template/handler.rb
actionpack-3.1.5.rc1 lib/action_view/template/handler.rb
actionpack-3.1.4 lib/action_view/template/handler.rb
actionpack-3.1.4.rc1 lib/action_view/template/handler.rb
actionpack-3.1.3 lib/action_view/template/handler.rb
actionpack-3.1.2 lib/action_view/template/handler.rb
actionpack-3.1.2.rc2 lib/action_view/template/handler.rb
actionpack-3.1.2.rc1 lib/action_view/template/handler.rb
actionpack-3.1.1 lib/action_view/template/handler.rb
actionpack-3.1.1.rc3 lib/action_view/template/handler.rb
actionpack-3.1.1.rc2 lib/action_view/template/handler.rb
actionpack-3.1.1.rc1 lib/action_view/template/handler.rb
actionpack-3.1.0 lib/action_view/template/handler.rb