roda-plugins 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/roda/plugins/components.rb +10 -5
- data/lib/roda/plugins/version.rb +1 -1
- 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: 1b9fb7d480e70461b53ccb4a61a5bc3bc00dee47
|
4
|
+
data.tar.gz: 9c2e1cc903dd3e04b0c968bcb1eb85616fae8971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d509c65399fa1006b9ba10f651824adf9e4d79616c9fcb223f34545d17bbb2af7b334f0be14cb19d91215c9c6b9c46ed7138ffdff3669d8762098ed2ad16758
|
7
|
+
data.tar.gz: a6f6116dfb0991b30fa264c51f932934d6108614a1d8fe32de132800c3d70c51d0077ca78c314c8638f848f1fe461e447a4ba69ae3318049d6107beee83bab45
|
@@ -69,10 +69,10 @@ class Roda
|
|
69
69
|
end
|
70
70
|
|
71
71
|
module InstanceMethods
|
72
|
-
def component(name, opts = {})
|
72
|
+
def component(name, opts = {}, &block)
|
73
73
|
name = name.to_s
|
74
74
|
|
75
|
-
component_request = ComponentRequest.new(self, self.class, name, opts)
|
75
|
+
component_request = ComponentRequest.new(self, self.class, name, opts, block)
|
76
76
|
|
77
77
|
content = catch :halt do
|
78
78
|
if setup_component = self.class.load_setup_component(name)
|
@@ -95,12 +95,13 @@ class Roda
|
|
95
95
|
class ComponentRequest
|
96
96
|
attr_reader :app, :component_class, :component_name, :component_opts, :cache
|
97
97
|
|
98
|
-
def initialize app, component_class, component_name, opts = {}
|
98
|
+
def initialize app, component_class, component_name, opts = {}, block
|
99
99
|
@app = app
|
100
100
|
@component_class = component_class
|
101
101
|
@component_name = component_name
|
102
102
|
@component_opts = opts
|
103
103
|
@cache = Roda::RodaCache.new
|
104
|
+
@_block = block
|
104
105
|
end
|
105
106
|
|
106
107
|
def on name, &block
|
@@ -116,14 +117,14 @@ class Roda
|
|
116
117
|
end
|
117
118
|
|
118
119
|
def html &block
|
119
|
-
|
120
|
+
comp_cache[:html_loaded] ||= begin
|
120
121
|
comp_cache[:html] ||= yield
|
121
122
|
true
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
125
126
|
def setup &block
|
126
|
-
|
127
|
+
comp_cache[:ran_setup] ||= begin
|
127
128
|
block.call comp_dom, comp_tmpl
|
128
129
|
true
|
129
130
|
end
|
@@ -169,6 +170,10 @@ class Roda
|
|
169
170
|
end
|
170
171
|
end
|
171
172
|
|
173
|
+
def block
|
174
|
+
@_block
|
175
|
+
end
|
176
|
+
|
172
177
|
private
|
173
178
|
|
174
179
|
def comp_dom
|
data/lib/roda/plugins/version.rb
CHANGED