roda-component 0.1.42 → 0.1.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/roda/component.rb +10 -0
- data/lib/roda/component/version.rb +1 -1
- data/lib/roda/plugins/component.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92de764f146e178968f17bebd9476cc8f7268278
|
4
|
+
data.tar.gz: 475b2bc9ef2c91d05393b79a9163e4a7ea4767eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 719b51510a012f8849d60942062988c6939a925ca5b2e5a1a8a9f5a4338ae7ab5c5a06afab0531ae36bb59643b08bcc684d54e0aa41498aa2edfa498ba84b939
|
7
|
+
data.tar.gz: 1848090168526fd3a4824297f07670ee97a5edd4a3381424111d721e93911025a1fb4a5a7f29968dee90c189319fe730c60564113ecbc1d29c69843f39c7b81a
|
data/lib/roda/component.rb
CHANGED
@@ -134,6 +134,10 @@ class Roda
|
|
134
134
|
obj
|
135
135
|
end
|
136
136
|
|
137
|
+
def comp_requires
|
138
|
+
(@_comp_requires ||= []).uniq
|
139
|
+
end
|
140
|
+
|
137
141
|
if RUBY_ENGINE == 'ruby'
|
138
142
|
def inherited(subclass)
|
139
143
|
super
|
@@ -235,6 +239,12 @@ class Roda
|
|
235
239
|
end
|
236
240
|
end
|
237
241
|
|
242
|
+
def comp_require *names
|
243
|
+
@_comp_requires ||= []
|
244
|
+
names.each { |n| @_comp_requires << n}
|
245
|
+
@_comp_requires
|
246
|
+
end
|
247
|
+
|
238
248
|
def HTML raw_html
|
239
249
|
if raw_html[/\A<!DOCTYPE/] || raw_html[/\A<html/]
|
240
250
|
Nokogiri::HTML(raw_html)
|
@@ -73,6 +73,12 @@ class Roda
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def load_component_js comp, action = false, options = {}
|
76
|
+
if comp.is_a? Roda::Component
|
77
|
+
comp.class.comp_requires.each do |c|
|
78
|
+
load_component_js(load_component(c), false, js: true)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
76
82
|
# grab a copy of the cache
|
77
83
|
cache = comp.class.cache.dup
|
78
84
|
# remove html and dom cache as we don't need that for the client
|