kontrol 0.3.3 → 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,13 +123,6 @@ module Kontrol
123
123
 
124
124
  response['Content-Type'] = guess_content_type if response['Content-Type'].empty?
125
125
  response.finish
126
-
127
- rescue => exception
128
- if ENV['RACK_ENV'] == 'production' and defined?(HoptoadNotifier)
129
- HoptoadNotifier.notify(exception)
130
- else
131
- raise exception
132
- end
133
126
  end
134
127
 
135
128
  def inspect
@@ -2,9 +2,7 @@ module Kontrol
2
2
 
3
3
  class View
4
4
 
5
- def initialize(app, variables)
6
- @__app__ = app
7
-
5
+ def initialize(variables)
8
6
  variables.each do |k, v|
9
7
  instance_variable_set "@#{k}", v
10
8
  end
@@ -15,8 +13,8 @@ module Kontrol
15
13
  end
16
14
 
17
15
  def method_missing(id, *args, &block)
18
- if @__app__.respond_to?(id)
19
- @__app__.send(id, *args, &block)
16
+ if @application.respond_to?(id)
17
+ @application.send(id, *args, &block)
20
18
  else
21
19
  super
22
20
  end
@@ -28,6 +26,8 @@ module Kontrol
28
26
  class Template
29
27
  include Helpers
30
28
 
29
+ attr_reader :file
30
+
31
31
  def initialize(app, file)
32
32
  @app = app
33
33
  @file = file
@@ -36,8 +36,8 @@ module Kontrol
36
36
  end
37
37
 
38
38
  def load
39
- @mtime = File.mtime(@file)
40
- @erb = ERB.new(File.read(@file))
39
+ @mtime = File.mtime(file)
40
+ @erb = ERB.new(File.read(file))
41
41
  end
42
42
 
43
43
  def changed?
@@ -47,11 +47,11 @@ module Kontrol
47
47
  def render(variables)
48
48
  load if ENV['RACK_ENV'] != 'production' and changed?
49
49
 
50
- @erb.result(View.new(@app, variables).__binding__)
50
+ @erb.result(View.new(variables.merge(:application => @app)).__binding__)
51
51
 
52
52
  rescue => e
53
53
  e.backtrace.each do |s|
54
- s.gsub!('(erb)', @file)
54
+ s.gsub!('(erb)', file)
55
55
  end
56
56
  raise e
57
57
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontrol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ hash: 3
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ version: "0.4"
5
10
  platform: ruby
6
11
  authors:
7
12
  - Matthias Georgi
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-08 00:00:00 +01:00
17
+ date: 2011-06-06 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -50,21 +55,27 @@ rdoc_options: []
50
55
  require_paths:
51
56
  - lib
52
57
  required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
53
59
  requirements:
54
60
  - - ">="
55
61
  - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
56
65
  version: "0"
57
- version:
58
66
  required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
59
68
  requirements:
60
69
  - - ">="
61
70
  - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
62
74
  version: "0"
63
- version:
64
75
  requirements: []
65
76
 
66
77
  rubyforge_project:
67
- rubygems_version: 1.3.5
78
+ rubygems_version: 1.4.2
68
79
  signing_key:
69
80
  specification_version: 3
70
81
  summary: a micro framework