rufus-sixjo 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rufus-sixjo.rb +3 -0
- data/lib/rufus/sixjo.rb +5 -3
- data/test/ft_3_erb.rb +12 -2
- metadata +3 -2
data/lib/rufus-sixjo.rb
ADDED
data/lib/rufus/sixjo.rb
CHANGED
@@ -65,7 +65,7 @@ module Rufus
|
|
65
65
|
|
66
66
|
module Sixjo
|
67
67
|
|
68
|
-
VERSION = '0.1.
|
68
|
+
VERSION = '0.1.3'
|
69
69
|
|
70
70
|
#
|
71
71
|
# Sixjo's Rack app
|
@@ -187,8 +187,8 @@ module Rufus
|
|
187
187
|
|
188
188
|
def method_missing (m, *args)
|
189
189
|
|
190
|
-
|
191
|
-
return
|
190
|
+
s = m.to_sym
|
191
|
+
return @locals[s] if @locals.has_key?(s)
|
192
192
|
|
193
193
|
@context.send(m, *args)
|
194
194
|
end
|
@@ -205,6 +205,8 @@ module Rufus
|
|
205
205
|
def erb (template, options = {})
|
206
206
|
|
207
207
|
content = File.read("views/#{template}.erb")
|
208
|
+
#
|
209
|
+
# TODO : make views/ configurable
|
208
210
|
|
209
211
|
l = options[:locals]
|
210
212
|
l = Local.new(self, l || {}) unless l.is_a?(Local)
|
data/test/ft_3_erb.rb
CHANGED
@@ -32,6 +32,10 @@ module ErbApp
|
|
32
32
|
get '/reckless' do
|
33
33
|
erb :view1
|
34
34
|
end
|
35
|
+
|
36
|
+
get '/good3' do
|
37
|
+
erb :view0, :whatever => true, :locals => { :life => nil }
|
38
|
+
end
|
35
39
|
end
|
36
40
|
|
37
41
|
class ErbTest < Test::Unit::TestCase
|
@@ -50,13 +54,19 @@ class ErbTest < Test::Unit::TestCase
|
|
50
54
|
assert_equal 500, get('/').status
|
51
55
|
|
52
56
|
assert_equal 200, get('/good').status
|
53
|
-
assert_equal 'this is view0, life is good', @response.body
|
57
|
+
assert_equal 'this is view0, life is good', @response.body
|
54
58
|
|
55
59
|
assert_equal 200, get('/good2').status
|
56
|
-
assert_equal 'this is view0, life is good', @response.body
|
60
|
+
assert_equal 'this is view0, life is good', @response.body
|
57
61
|
|
58
62
|
assert_equal 200, get('/reckless').status
|
59
63
|
assert_equal '/reckless', @response.body.strip
|
60
64
|
end
|
65
|
+
|
66
|
+
def test_1
|
67
|
+
|
68
|
+
assert_equal 200, get('/good3').status
|
69
|
+
assert_equal 'this is view0, life is ', @response.body
|
70
|
+
end
|
61
71
|
end
|
62
72
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-sixjo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-09 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -33,6 +33,7 @@ extra_rdoc_files:
|
|
33
33
|
files:
|
34
34
|
- lib/rufus
|
35
35
|
- lib/rufus/sixjo.rb
|
36
|
+
- lib/rufus-sixjo.rb
|
36
37
|
- test/ft_0_simple.rb
|
37
38
|
- test/ft_1_helpers.rb
|
38
39
|
- test/ft_2_redirect.rb
|