Sha256: d9e12b897ae9376d397c003f5e030ee599ffd19e7f1050ddbbd29ad860ce615c
Contents?: true
Size: 993 Bytes
Versions: 2
Compression:
Stored size: 993 Bytes
Contents
require 'malt/formats/abstract' require 'malt/formats/html' require 'malt/engines/builder' module Malt::Format # Builder looks like a Markup format, but it is a template format # as Ruby code. # # http://builder.rubyforge.org/ # class Builder < Abstract register 'builder' # def builder(*) text end # def to_builder(*) self end # def html(data=nil, &yld) render_engine.render(:format=>:html, :text=>text, :file=>file, :data=>data, &yld) end # def to_html(data=nil, &yld) text = html(data, &yld) opts = options.merge(:text=>text, :file=>refile(:html), :type=>:html) HTML.new(opts) end # #def to_ruby(db, &yld) # @ruby ||= ( # source = engine.compile(text, file) # Ruby.new(:text=>source, :file=>refile(:rb)) # ) #end private # def render_engine @render_engine ||= Malt::Engine::Builder.new(options) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
malt-0.3.0 | lib/malt/formats/builder.rb |
malt-0.2.0 | lib/malt/formats/builder.rb |