Sha256: 237b649e9c9927f86a72494e86db0695fb2c629a62c8db39da894e7d1ac2568d

Contents?: true

Size: 556 Bytes

Versions: 10

Compression:

Stored size: 556 Bytes

Contents

# -*- coding: utf-8 -*-
require 'erubis'

module KnifeSkeleton
  # Render template
  class Template
    # Static: Render template with Erubis
    #
    # Examples:
    #
    #   KnifeSkeleton::Template.render('Hello <%= title %>', {title: 'GoT'})
    #   # => "Hello GoT"
    #
    # @param [String] template Template string to used for rendering
    # @param [String] data     Data binding
    # return [String]
    def self.render(template, data)
      eruby = Erubis::Eruby.new(template)
      output = eruby.result(data)
      output
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
knife-skeleton-0.6.1 lib/knife_skeleton/template.rb
knife-skeleton-0.6.0 lib/knife_skeleton/template.rb
knife-skeleton-0.5.1 lib/knife_skeleton/template.rb
knife-skeleton-0.5.0 lib/knife_skeleton/template.rb
knife-skeleton-0.4.0 lib/knife_skeleton/template.rb
knife-skeleton-0.3.0 lib/knife_skeleton/template.rb
knife-skeleton-0.2.0 lib/knife_skeleton/template.rb
knife-skeleton-0.1.0 lib/knife_skeleton/template.rb
knife-skeleton-0.0.4 lib/knife_skeleton/template.rb
knife-skeleton-0.0.3 lib/knife_skeleton/template.rb