Template.render()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 3
rs 10
cc 1
1
module Kerb
2
  class Template
3
    def initialize(erb, vars)
4
      @erb = erb
5
      vars.each { |k, v| instance_variable_set("@#{k}", v) }
6
    end
7
8
    def render
9
      ERB.new(@erb).result(binding)
10
    end
11
12
    def render_to_file(file)
13
      File.open(file, 'w') { |f| f.write(render) }
14
    end
15
  end
16
end
17