kontrol 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kontrol/template.rb +6 -4
- metadata +1 -1
data/lib/kontrol/template.rb
CHANGED
@@ -2,7 +2,9 @@ module Kontrol
|
|
2
2
|
|
3
3
|
class View
|
4
4
|
|
5
|
-
def initialize(variables)
|
5
|
+
def initialize(app, variables)
|
6
|
+
@__app__ = app
|
7
|
+
|
6
8
|
variables.each do |k, v|
|
7
9
|
instance_variable_set "@#{k}", v
|
8
10
|
end
|
@@ -34,8 +36,8 @@ module Kontrol
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def load
|
37
|
-
@mtime = File.mtime(file)
|
38
|
-
@erb = ERB.new(File.read(file))
|
39
|
+
@mtime = File.mtime(@file)
|
40
|
+
@erb = ERB.new(File.read(@file))
|
39
41
|
end
|
40
42
|
|
41
43
|
def changed?
|
@@ -49,7 +51,7 @@ module Kontrol
|
|
49
51
|
|
50
52
|
rescue => e
|
51
53
|
e.backtrace.each do |s|
|
52
|
-
s.gsub!('(erb)', file)
|
54
|
+
s.gsub!('(erb)', @file)
|
53
55
|
end
|
54
56
|
raise e
|
55
57
|
end
|