Sha256: 5fbe4a998d55a8d08dcf7e4d3f2bacf1f3ea47aaa27cb23da43097809fbc351c

Contents?: true

Size: 739 Bytes

Versions: 2

Compression:

Stored size: 739 Bytes

Contents

require 'malt/formats/abstract'
require 'malt/formats/html'
require 'malt/engines/radius'

module Malt::Format

  # Radius Template
  #
  #   http://github.com/jlong/radius/
  #
  class Radius < Abstract

    register('radius')

    #
    def radius(*)
      text
    end

    #
    def to_radius(*)
      self
    end

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

    private

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

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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