Template   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %
Metric Value
wmc 3
dl 0
loc 14
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 4 1
A render() 0 3 1
A render_to_file() 0 3 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