Class: Minfra::Cli::Templater::ERBPlus

Inherits:
ERB
  • Object
show all
Defined in:
lib/minfra/cli/templater.rb

Overview

Instance Method Summary collapse

Instance Method Details

#result_with(hash: {}, helpers: []) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/minfra/cli/templater.rb', line 15

def result_with(hash: {}, helpers: [])
  b = TemplateBinding.new
  hash.each_pair do |key, value|
    b.define_singleton_method(key) do value end
  end
  helpers.each do |helper|
    b.extend helper
  end
  result(b._binding)
end