ruhl 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/ruhl/engine.rb +7 -5
- data/ruhl.gemspec +3 -2
- data/spec/html/parameters.html +22 -0
- data/spec/ruhl_spec.rb +17 -5
- data/spec/spec_helper.rb +4 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
data/lib/ruhl/engine.rb
CHANGED
@@ -186,12 +186,14 @@ module Ruhl
|
|
186
186
|
if code == '_render_'
|
187
187
|
_render_
|
188
188
|
else
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
189
|
+
args = code.strip.split(' ')
|
190
|
+
|
191
|
+
if block_object.respond_to?(code)
|
192
|
+
block_object.send(*args)
|
193
|
+
elsif local_object.respond_to?(code)
|
194
|
+
local_object.send(*args)
|
193
195
|
else
|
194
|
-
scope.send(
|
196
|
+
scope.send(*args)
|
195
197
|
end
|
196
198
|
end
|
197
199
|
rescue NoMethodError => e
|
data/ruhl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruhl}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.11.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Stone"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-26}
|
13
13
|
s.description = %q{Make your HTML dynamic with the addition of a data-ruhl attribute.}
|
14
14
|
s.email = %q{andy@stonean.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
"spec/html/main_with_form.html",
|
39
39
|
"spec/html/main_with_sidebar.html",
|
40
40
|
"spec/html/medium.html",
|
41
|
+
"spec/html/parameters.html",
|
41
42
|
"spec/html/seo.html",
|
42
43
|
"spec/html/sidebar.html",
|
43
44
|
"spec/html/use.html",
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>This is a title template</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<div id="wrap">
|
7
|
+
<div id="sidebar" data-ruhl="_partial: partial sidebar">
|
8
|
+
<h3>Sidebar links</h3>
|
9
|
+
<ul>
|
10
|
+
<li><a href="#">Link 1</a></li>
|
11
|
+
<li><a href="#">Link 2</a></li>
|
12
|
+
<li><a href="#">Link 3</a></li>
|
13
|
+
<li><a href="#">Link 4</a></li>
|
14
|
+
</ul>
|
15
|
+
</div>
|
16
|
+
<div id="main">
|
17
|
+
<h1> My main content</h1>
|
18
|
+
<p>Text designers would put here to test their layout</p>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</body>
|
22
|
+
</html>
|
data/spec/ruhl_spec.rb
CHANGED
@@ -67,11 +67,7 @@ describe Ruhl do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
|
71
|
-
before do
|
72
|
-
@html = File.read html(:main_with_sidebar)
|
73
|
-
end
|
74
|
-
|
70
|
+
shared_examples_for "having sidebar" do
|
75
71
|
it "should replace sidebar with partial contents" do
|
76
72
|
doc = create_doc
|
77
73
|
doc.xpath('/html/body/div/div/div//h3')[0].inner_html.
|
@@ -82,6 +78,22 @@ describe Ruhl do
|
|
82
78
|
end
|
83
79
|
end
|
84
80
|
|
81
|
+
describe "main_with_sidebar.html" do
|
82
|
+
before do
|
83
|
+
@html = File.read html(:main_with_sidebar)
|
84
|
+
end
|
85
|
+
|
86
|
+
it_should_behave_like "having sidebar"
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "parameters.html" do
|
90
|
+
before do
|
91
|
+
@html = File.read html(:parameters)
|
92
|
+
end
|
93
|
+
|
94
|
+
it_should_behave_like "having sidebar"
|
95
|
+
end
|
96
|
+
|
85
97
|
shared_examples_for "if with no users" do
|
86
98
|
it "table should not render" do
|
87
99
|
nodes = @doc.xpath('/html/body//*')
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruhl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Stone
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-26 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- spec/html/main_with_form.html
|
64
64
|
- spec/html/main_with_sidebar.html
|
65
65
|
- spec/html/medium.html
|
66
|
+
- spec/html/parameters.html
|
66
67
|
- spec/html/seo.html
|
67
68
|
- spec/html/sidebar.html
|
68
69
|
- spec/html/use.html
|