Sha256: 79de82b75ce5c3dc6199d80c5da29f309963dfca0dfb1f3be3551aee2ce6d4d4
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
## ## an implementation of eRuby ## ## ex. ## input = <<'END' ## <ul> ## <% for item in @list %> ## <li><%= item %> ## <%== item %></li> ## <% end %> ## </ul> ## END ## list = ['<aaa>', 'b&b', '"ccc"'] ## eruby = Erubis::Eruby.new(input) ## puts "--- code ---" ## puts eruby.src ## puts "--- result ---" ## context = Erubis::Context.new() # or new(:list=>list) ## context[:list] = list ## puts eruby.evaluate(context) ## ## result: ## --- source --- ## _buf = ''; _buf << '<ul> ## '; for item in @list ## _buf << ' <li>'; _buf << ( item ).to_s; _buf << ' ## '; _buf << ' '; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</li> ## '; end ## _buf << '</ul> ## '; ## _buf.to_s ## --- result --- ## <ul> ## <li><aaa> ## <aaa></li> ## <li>b&b ## b&b</li> ## <li>"ccc" ## "ccc"</li> ## </ul> ## module Erbse end require 'erbse/engine' # require 'erbse/helper' # require 'erbse/enhancer' require 'erbse/engine/eruby' # require 'erbse/local-setting'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
erbse-0.0.1 | lib/erbse.rb |