Skip to content

Instantly share code, notes, and snippets.

@vroy
Created July 26, 2009 03:45
Show Gist options
  • Save vroy/155424 to your computer and use it in GitHub Desktop.
Save vroy/155424 to your computer and use it in GitHub Desktop.
how to change the extensions for a templating engine in ramaze
index.asdf
require 'rubygems'
require 'ramaze'
require 'nagoro'
Ramaze::View::ENGINE["asdf"] = "Innate::View::Nagoro"
Ramaze::View::ENGINE.delete("nag")
class MainController < Ramaze::Controller
engine :Nagoro
def index
"index.action"
end
end
Ramaze.start
After finding out that this line
http://github.com/manveru/ramaze/blob/37470de0a33cb69ee0a491458be8c85bcf4900e2/lib/ramaze/view.rb#L32 makes the Nagoro engine have the "nag" extension, I played around and found that Ramaze::VIEW::ENGINE is a mapping of "extension" => "Innate::View::TemplateEngine". That's why you can do this anywhere before your view gets rendered:
Ramaze::View::ENGINE["asdf"] = "Innate::View::Nagoro"
Ramaze::View::ENGINE.delete("nag")
Of course you can always change L32 of view.rb to `auto_register :Nagoro, :asdf`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment