Created
July 26, 2009 03:45
-
-
Save vroy/155424 to your computer and use it in GitHub Desktop.
how to change the extensions for a templating engine in ramaze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.asdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.nag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.asdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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