Sha256: 4356956b27462f52a01bf52587bcd406360b5e4ec83954a8046e3c610adb279f

Contents?: true

Size: 766 Bytes

Versions: 1

Compression:

Stored size: 766 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engines

  # RTALS
  #
  #  http://github.com/rubyworks/rtals
  #
  class RTALS < Abstract

    default :rtal

    #
    def render(params, &yld)
      text   = params[:text]
      file   = params[:file]
      data   = params[:data]
      format = params[:format]

      case format
      when :html, :xml, nil
        data = make_binding(data, &yld)
        intermediate(params).compile(data).to_s
      else
        super(params, &yld)
      end
    end

    #
    def intermediate(params)
      text = params[:text]
      ::RTAL.new(text)
    end

    private

    # Load Haml library if not already loaded.
    def initialize_engine
      return if defined? ::RTAL
      require_library 'rtals'
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
malt-0.1.0 lib/malt/engines/rtals.rb