Sha256: 803aa2fdbe5585bc602eaa1e92e6d78dbe75ba1e94a9d5fae56ec24a63ed0df9

Contents?: true

Size: 932 Bytes

Versions: 2

Compression:

Stored size: 932 Bytes

Contents

require 'malt/formats/abstract'
require 'malt/formats/html'
require 'malt/formats/xml'
require 'malt/engines/ragtag'

module Malt::Format

  # RagTag
  #
  #  http://github.com/rubyworks/ragtag
  #
  class RagTag < Abstract

    register('ragtag', 'rt')

    #
    def html(data=nil, &yld)
      render_engine.render(:text=>text, :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 xml(data=nil, &yld)
      render_engine.render(:text=>text, :data=>data, &yld)
    end

    #
    def to_xml(data=nil, &yld)
      text = xml(data, &yld)
      opts = options.merge(:text=>text, :file=>refile(:xml), :type=>:xml)
      XML.new(opts)
    end

    private

      #
      def render_engine
        @render_engine ||= Malt::Engine::RagTag.new(options)
      end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
malt-0.3.0 lib/malt/formats/ragtag.rb
malt-0.2.0 lib/malt/formats/ragtag.rb