Module: Yapra::Plugin::ErbApplier

Included in:
Base
Defined in:
lib/yapra/plugin/erb_applier.rb

Instance Method Summary collapse

Instance Method Details

#apply_template(template, apply_binding = binding) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/yapra/plugin/erb_applier.rb', line 6

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, nil, '-').result(apply_binding)
end