嵌入式 Ruby Erubis
Erubis 是一個快速、安全和具備高可擴展性的 eRuby 的實現,主要特征如下:
- 快速,幾乎是 ERB 的三倍,比用C開發的eRuby還要快10%
- File caching of converted Ruby script support.
- Auto escaping (sanitizing) support, it means that '<%= %>' can be escaped in default. It is desirable for web application.
- Spaces around '<% %>' are trimmed automatically only when '<%' is at the beginning of line and '%>' is at the end of line.
- Embedded pattern changeable (default '<% %>'), for example '[% %]' or ' ' are available.
- Enable to handle Processing Instructions (PI) as embedded pattern (ex. ' '). This is desirable for XML/HTML than '<% .. %>' because the latter breaks HTML design but the former doesn't.
- Multi-language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript).
- Context object available and easy to combine eRuby template with YAML datafile (see the below example).
- Print statement available.
- Easy to expand and customize in subclass
- Print statement support
- Lines starting with percent character ('%') support
- Another embedded pattern support
- etc...
- Ruby on Rails support.
- Mod_ruby support.
下圖是幾個嵌入式 Ruby 的性能比較:
本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!