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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e57720fc53bf74e0e32db8cfd78c742aa77538aa
4
- data.tar.gz: 88e8b157c0497c697863c68e77f81796607e28e0
3
+ metadata.gz: 1b9fb7d480e70461b53ccb4a61a5bc3bc00dee47
4
+ data.tar.gz: 9c2e1cc903dd3e04b0c968bcb1eb85616fae8971
5
5
  SHA512:
6
- metadata.gz: ea90f36ab3c06bbc897bb4186e9adbe7e0c866349d63e62ebb29c3f41435b4858918b7a5e341ada84f076e7bc0b8da086d401d0fcc4c9517ec2bd32b1331ac0d
7
- data.tar.gz: 968e3ba2f0bddd796d63c7be23e41631176686f12c5e9a4c3a96a4e20397097507dfd317ec96462ac34807c5d49b6d595e67f0a5834c8845426ae98f8beea530
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
- class_cache[:html_loaded] ||= begin
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
- class_cache[:ran_setup] ||= begin
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
@@ -1,3 +1,3 @@
1
1
  class Roda
2
- PluginsVersion = '0.0.4'.freeze
2
+ PluginsVersion = '0.0.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj