Sha256: 739839a97d3c159ef4555b4a4590dd6f4839ce09f8b09a8ae0ea5a380f27235b

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engine

  # 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.1 lib/malt/engines/rtals.rb