ruhl 0.26.1 → 1.0.0
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.
- data/VERSION +1 -1
- data/lib/ruhl/engine.rb +3 -3
- data/lib/ruhl/sinatra.rb +13 -0
- data/ruhl.gemspec +2 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/lib/ruhl/engine.rb
CHANGED
@@ -6,11 +6,9 @@ module Ruhl
|
|
6
6
|
def initialize(html, options = {})
|
7
7
|
@local_object = options[:local_object] || options[:object]
|
8
8
|
@block_object = options[:block_object]
|
9
|
+
@layout = options[:layout]
|
9
10
|
@layout_source = options[:layout_source]
|
10
11
|
|
11
|
-
if @layout = options[:layout]
|
12
|
-
raise LayoutNotFoundError.new(@layout) unless File.exists?(@layout)
|
13
|
-
end
|
14
12
|
|
15
13
|
if @layout || @local_object || @block_object
|
16
14
|
@document = Nokogiri::HTML.fragment(html)
|
@@ -44,6 +42,8 @@ module Ruhl
|
|
44
42
|
private
|
45
43
|
|
46
44
|
def render_with_layout
|
45
|
+
raise LayoutNotFoundError.new(@layout) unless File.exists?(@layout)
|
46
|
+
|
47
47
|
render_nodes Nokogiri::HTML( @layout_source || File.read(@layout) )
|
48
48
|
end
|
49
49
|
|
data/lib/ruhl/sinatra.rb
CHANGED
@@ -30,8 +30,21 @@ end
|
|
30
30
|
|
31
31
|
module Ruhl
|
32
32
|
class Engine
|
33
|
+
|
33
34
|
private
|
34
35
|
|
36
|
+
def render_with_layout
|
37
|
+
if @layout_source
|
38
|
+
data = @layout_source
|
39
|
+
else
|
40
|
+
views = scope.class.views || "./views"
|
41
|
+
data, filename, line = scope.send(:lookup_template, :ruhl, @layout.to_sym, views)
|
42
|
+
end
|
43
|
+
|
44
|
+
render_nodes Nokogiri::HTML(data)
|
45
|
+
end
|
46
|
+
|
47
|
+
|
35
48
|
def render_partial
|
36
49
|
views = scope.class.views || "./views"
|
37
50
|
|
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 = "1.0.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{2010-01-
|
12
|
+
s.date = %q{2010-01-21}
|
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 = [
|
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: 1.0.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: 2010-01-
|
12
|
+
date: 2010-01-21 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|