dependo 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Dependo
8
8
 
9
- &mdash; Documentation by YARD 0.8.2.1
9
+ &mdash; Documentation by YARD 0.8.3
10
10
 
11
11
  </title>
12
12
 
@@ -126,7 +126,7 @@
126
126
 
127
127
  </div>
128
128
  </dt>
129
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1</span><span class='tstring_end'>&quot;</span></span></pre></dd>
129
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2</span><span class='tstring_end'>&quot;</span></span></pre></dd>
130
130
 
131
131
  </dl>
132
132
 
@@ -142,9 +142,9 @@
142
142
  </div>
143
143
 
144
144
  <div id="footer">
145
- Generated on Thu Oct 25 14:04:32 2012 by
145
+ Generated on Tue Jan 29 09:38:58 2013 by
146
146
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
147
- 0.8.2.1 (ruby-1.9.3).
147
+ 0.8.3 (ruby-1.9.3).
148
148
  </div>
149
149
 
150
150
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Dependo::Mixin
8
8
 
9
- &mdash; Documentation by YARD 0.8.2.1
9
+ &mdash; Documentation by YARD 0.8.3
10
10
 
11
11
  </title>
12
12
 
@@ -134,6 +134,31 @@ do both.</p>
134
134
  <p>The injected dependency in the Dependo::Registry with the given name.</p>
135
135
  </div></span>
136
136
 
137
+ </li>
138
+
139
+
140
+ <li class="public ">
141
+ <span class="summary_signature">
142
+
143
+ <a href="#respond_to%3F-instance_method" title="#respond_to? (instance method)">- (Boolean) <strong>respond_to?</strong>(key, include_private = false) </a>
144
+
145
+
146
+
147
+ </span>
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+ <span class="summary_desc"><div class='inline'>
158
+ <p>True if the Dependo::Registry has this method, otherwise check the actual
159
+ object (using super).</p>
160
+ </div></span>
161
+
137
162
  </li>
138
163
 
139
164
 
@@ -255,12 +280,125 @@ do both.</p>
255
280
  </div>
256
281
 
257
282
 
283
+ <div id="instance_method_details" class="method_details_list">
284
+ <h2>Instance Method Details</h2>
285
+
286
+
287
+ <div class="method_details first">
288
+ <h3 class="signature first" id="respond_to?-instance_method">
289
+
290
+ - (<tt>Boolean</tt>) <strong>respond_to?</strong>(key, include_private = false)
291
+
292
+
293
+
294
+
295
+
296
+ </h3><div class="docstring">
297
+ <div class="discussion">
298
+
299
+ <p>True if the Dependo::Registry has this method, otherwise check the actual
300
+ object (using super)</p>
301
+
302
+
303
+ </div>
304
+ </div>
305
+ <div class="tags">
306
+ <p class="tag_title">Parameters:</p>
307
+ <ul class="param">
308
+
309
+ <li>
310
+
311
+ <span class='name'>key</span>
312
+
313
+
314
+ <span class='type'>(<tt>symbol</tt>)</span>
315
+
316
+
317
+
318
+ &mdash;
319
+ <div class='inline'>
320
+ <p>the name of the method</p>
321
+ </div>
322
+
323
+ </li>
324
+
325
+ <li>
326
+
327
+ <span class='name'>include_private</span>
328
+
329
+
330
+ <span class='type'>(<tt>boolean</tt>)</span>
331
+
332
+
333
+ <em class="default">(defaults to: <tt>false</tt>)</em>
334
+
335
+
336
+ &mdash;
337
+ <div class='inline'>
338
+ <p>(optional)</p>
339
+ </div>
340
+
341
+ </li>
342
+
343
+ </ul>
344
+
345
+ <p class="tag_title">Returns:</p>
346
+ <ul class="return">
347
+
348
+ <li>
349
+
350
+
351
+ <span class='type'>(<tt>Boolean</tt>)</span>
352
+
353
+
354
+
355
+ &mdash;
356
+ <div class='inline'>
357
+ <p>true if the Dependo::Registry has this method, otherwise check the actual
358
+ object (using super)</p>
359
+ </div>
360
+
361
+ </li>
362
+
363
+ </ul>
364
+
365
+ </div><table class="source_code">
366
+ <tr>
367
+ <td>
368
+ <pre class="lines">
369
+
370
+
371
+ 57
372
+ 58
373
+ 59
374
+ 60
375
+ 61
376
+ 62
377
+ 63</pre>
378
+ </td>
379
+ <td>
380
+ <pre class="code"><span class="info file"># File 'lib/dependo.rb', line 57</span>
381
+
382
+ <span class='kw'>def</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_include_private'>include_private</span><span class='op'>=</span><span class='kw'>false</span><span class='rparen'>)</span>
383
+ <span class='kw'>if</span> <span class='const'>Dependo</span><span class='op'>::</span><span class='const'>Registry</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
384
+ <span class='kw'>true</span>
385
+ <span class='kw'>else</span>
386
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_include_private'>include_private</span><span class='rparen'>)</span>
387
+ <span class='kw'>end</span>
388
+ <span class='kw'>end</span></pre>
389
+ </td>
390
+ </tr>
391
+ </table>
392
+ </div>
393
+
394
+ </div>
395
+
258
396
  </div>
259
397
 
260
398
  <div id="footer">
261
- Generated on Thu Oct 25 14:04:32 2012 by
399
+ Generated on Tue Jan 29 09:38:58 2013 by
262
400
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
263
- 0.8.2.1 (ruby-1.9.3).
401
+ 0.8.3 (ruby-1.9.3).
264
402
  </div>
265
403
 
266
404
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Dependo::Registry
8
8
 
9
- &mdash; Documentation by YARD 0.8.2.1
9
+ &mdash; Documentation by YARD 0.8.3
10
10
 
11
11
  </title>
12
12
 
@@ -599,9 +599,9 @@
599
599
  </div>
600
600
 
601
601
  <div id="footer">
602
- Generated on Thu Oct 25 14:04:32 2012 by
602
+ Generated on Tue Jan 29 09:38:58 2013 by
603
603
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
604
- 0.8.2.1 (ruby-1.9.3).
604
+ 0.8.3 (ruby-1.9.3).
605
605
  </div>
606
606
 
607
607
  </body>
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
6
  <title>
7
- Documentation by YARD 0.8.2.1
7
+ Documentation by YARD 0.8.3
8
8
 
9
9
  </title>
10
10
 
@@ -56,7 +56,7 @@
56
56
 
57
57
  <iframe id="search_frame"></iframe>
58
58
 
59
- <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.2.1</h1>
59
+ <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.3</h1>
60
60
  <div id="listing">
61
61
  <h1 class="alphaindex">Alphabetic Index</h1>
62
62
 
@@ -131,9 +131,9 @@
131
131
  </div>
132
132
 
133
133
  <div id="footer">
134
- Generated on Thu Oct 25 14:04:31 2012 by
134
+ Generated on Tue Jan 29 09:38:58 2013 by
135
135
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
136
- 0.8.2.1 (ruby-1.9.3).
136
+ 0.8.3 (ruby-1.9.3).
137
137
  </div>
138
138
 
139
139
  </body>
@@ -2,11 +2,11 @@
2
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
  <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.2.1
9
+ &mdash; Documentation by YARD 0.8.3
10
10
 
11
11
  </title>
12
12
 
@@ -123,9 +123,9 @@
123
123
  </div></div>
124
124
 
125
125
  <div id="footer">
126
- Generated on Thu Oct 25 14:04:31 2012 by
126
+ Generated on Tue Jan 29 09:38:58 2013 by
127
127
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
128
- 0.8.2.1 (ruby-1.9.3).
128
+ 0.8.3 (ruby-1.9.3).
129
129
  </div>
130
130
 
131
131
  </body>
@@ -4,7 +4,7 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Documentation by YARD 0.8.2.1</title>
7
+ <title>Documentation by YARD 0.8.3</title>
8
8
  </head>
9
9
  <script type="text/javascript" charset="utf-8">
10
10
  window.onload = function() {
@@ -2,11 +2,11 @@
2
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
4
  <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.2.1
9
+ &mdash; Documentation by YARD 0.8.3
10
10
 
11
11
  </title>
12
12
 
@@ -123,9 +123,9 @@
123
123
  </div></div>
124
124
 
125
125
  <div id="footer">
126
- Generated on Thu Oct 25 14:04:31 2012 by
126
+ Generated on Tue Jan 29 09:38:58 2013 by
127
127
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
128
- 0.8.2.1 (ruby-1.9.3).
128
+ 0.8.3 (ruby-1.9.3).
129
129
  </div>
130
130
 
131
131
  </body>
@@ -94,6 +94,14 @@
94
94
  </li>
95
95
 
96
96
 
97
+ <li class="r1 ">
98
+ <span class='object_link'><a href="Dependo/Mixin.html#respond_to%3F-instance_method" title="Dependo::Mixin#respond_to? (method)">#respond_to?</a></span>
99
+
100
+ <small>Dependo::Mixin</small>
101
+
102
+ </li>
103
+
104
+
97
105
  </ul>
98
106
  </div>
99
107
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.8.2.1
9
+ &mdash; Documentation by YARD 0.8.3
10
10
 
11
11
  </title>
12
12
 
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Thu Oct 25 14:04:32 2012 by
106
+ Generated on Tue Jan 29 09:38:58 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.2.1 (ruby-1.9.3).
108
+ 0.8.3 (ruby-1.9.3).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -1,7 +1,7 @@
1
1
  # Dependency Injection Framework
2
2
  module Dependo
3
3
  # The gem version
4
- VERSION = "0.1"
4
+ VERSION = "0.2"
5
5
 
6
6
  # Where dependencies are specified (or registered), and stored for future use
7
7
  class Registry
@@ -50,5 +50,16 @@ module Dependo
50
50
  raise NoMethodError, "undefined method '#{key.to_s}' for #{self.to_s}"
51
51
  end
52
52
  end
53
+
54
+ # @param key [symbol] the name of the method
55
+ # @param include_private [boolean] (optional)
56
+ # @return true if the Dependo::Registry has this method, otherwise check the actual object (using super)
57
+ def respond_to?(key, include_private=false)
58
+ if Dependo::Registry.has_key?(key)
59
+ true
60
+ else
61
+ super(key, include_private)
62
+ end
63
+ end
53
64
  end
54
65
  end
@@ -98,6 +98,22 @@ describe Dependo::Registry do
98
98
  obj = TestInclude.new
99
99
  expect { obj.not_provided }.to raise_error(NoMethodError, /undefined method 'not_provided' for #<TestInclude:0x[0-9a-f]+>/)
100
100
  end
101
+
102
+ it "when a method is defined" do
103
+ obj = TestInclude.new
104
+ obj.should respond_to(:my_method)
105
+ end
106
+
107
+ it "when a method is not defined" do
108
+ obj = TestInclude.new
109
+ obj.should_not respond_to(:undefined_method)
110
+ end
111
+
112
+ it "when a method is injected" do
113
+ Dependo::Registry[:thing] = "this thing"
114
+ obj = TestInclude.new
115
+ obj.should respond_to(:thing)
116
+ end
101
117
  end
102
118
 
103
119
  context "extend" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependo
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-25 00:00:00.000000000 Z
12
+ date: 2013-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2151876120 !ruby/object:Gem::Requirement
16
+ requirement: &2156903660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2151876120
24
+ version_requirements: *2156903660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &2151874940 !ruby/object:Gem::Requirement
27
+ requirement: &2156902080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2151874940
35
+ version_requirements: *2156902080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: simplecov
38
- requirement: &2151873420 !ruby/object:Gem::Requirement
38
+ requirement: &2156900340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2151873420
46
+ version_requirements: *2156900340
47
47
  description: A dependency injection framework for Ruby, which allows you to register
48
48
  dependencies and access them anywhere in your program
49
49
  email: sirsean@gmail.com