require 'action_view/base' require 'action_view/template' module ActionView #---------------- class Base #--------- cattr_accessor :pretty_json @@pretty_json = false end end module ActionView #---------------- module Template::Handlers #------------------------ class Notator #------------ # default format used by Notator class_attribute :default_format self.default_format = Mime::JSON def call( template ) #------------------- "json = ::Notator::JavascriptObjectNotation.new();" + "(" + template.source + ");" + "json.to_json;" end end end end ActionView::Template. register_template_handler :notator, ActionView::Template::Handlers::Notator.new