Sha256: 54b3d6c091426ecd1299fcc8a5b1cf880951df4cd9d42d9ef4c8a216c131bf2d

Contents?: true

Size: 337 Bytes

Versions: 1

Compression:

Stored size: 337 Bytes

Contents

require 'yapra/plugin'
require 'erb'
require 'uri'

module Yapra::Plugin::ErbApplier
  def apply_template template, apply_binding=binding
    if template.index('file://') == 0
      path = URI.parse(template).path
      open(path) do |io|
        template = io.read
      end
    end
    ERB.new(template).result(apply_binding)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yapra-0.1.0 lib/yapra/plugin/erb_applier.rb