Sha256: a6b7faa9f38db76f825d776977b6bb81a2dc8c9625ff7ff97b0530e76d5aa80c

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

module Saml
  module Kit
    class Template
      attr_reader :target

      def initialize(target)
        @target = target
      end

      # Returns the compiled template as a [String].
      #
      # @param options [Hash] The options hash to pass to the template engine.
      def to_xml(options)
        template.render(target, options)
      end

      private

      def template_name
        "#{target.class.name.split("::").last.underscore}.builder"
      end

      def template_path
        root_path = File.expand_path(File.dirname(__FILE__))
        File.join(root_path, "builders/templates/", template_name)
      end

      def template
        Tilt.new(template_path)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
saml-kit-0.3.0 lib/saml/kit/template.rb
saml-kit-0.2.18 lib/saml/kit/template.rb
saml-kit-0.2.17 lib/saml/kit/template.rb
saml-kit-0.2.16 lib/saml/kit/template.rb
saml-kit-0.2.15 lib/saml/kit/template.rb