This file is indexed.

/usr/share/doc/libneedle-ruby1.8/api/classes/Needle/Interceptor.html is in libneedle-ruby1.8 1.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Needle::Interceptor</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Needle::Interceptor</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/needle/interceptor_rb.html">
                lib/needle/interceptor.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
This represents the definition of an interceptor as it is attached to a
service point. Instances of <a href="Interceptor.html">Interceptor</a> are
also used for configuring themselves programmatically.
</p>
<p>
You will almost never instantiate an <a
href="Interceptor.html">Interceptor</a> object directly. Instead, use the
<a href="Container.html#M000060">Container#intercept</a> method. You can
then configure the new interceptor by chaining methods of the new object
together, quite readably:
</p>
<pre>
  container.intercept( :foo ).with! { some_interceptor }.
    with_options( :arg =&gt; :value )
</pre>
<p>
You can also create new interceptors on the fly via the <a
href="Interceptor.html#M000104">Interceptor#doing</a> method.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000106">[]</a>&nbsp;&nbsp;
      <a href="#M000107">[]=</a>&nbsp;&nbsp;
      <a href="#M000101">action</a>&nbsp;&nbsp;
      <a href="#M000104">doing</a>&nbsp;&nbsp;
      <a href="#M000100">new</a>&nbsp;&nbsp;
      <a href="#M000102">with</a>&nbsp;&nbsp;
      <a href="#M000103">with!</a>&nbsp;&nbsp;
      <a href="#M000105">with_options</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Class <a href="Interceptor/DynamicInterceptor.html" class="link">Needle::Interceptor::DynamicInterceptor</a><br />

    </div>




    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">options</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc">
The set of options that were given to this interceptor via the <a
href="Interceptor.html#M000105">with_options</a> method.

</td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000100" class="method-detail">
        <a name="M000100"></a>

        <div class="method-heading">
          <a href="#M000100" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create a new <a href="Interceptor.html">Interceptor</a> definition. By
default, it has no implementation and a priority of 0.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000100-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000100-source">
<pre>
    <span class="ruby-comment cmt"># File lib/needle/interceptor.rb, line 81</span>
81:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
82:       <span class="ruby-ivar">@options</span> = { <span class="ruby-identifier">:priority</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> }
83:       <span class="ruby-ivar">@doing</span> = <span class="ruby-ivar">@with</span> = <span class="ruby-keyword kw">nil</span>
84:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000106" class="method-detail">
        <a name="M000106"></a>

        <div class="method-heading">
          <a href="#M000106" class="method-signature">
          <span class="method-name">[]</span><span class="method-args">( name )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
A convenience method for querying the options on an interceptor definition.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000106-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000106-source">
<pre>
     <span class="ruby-comment cmt"># File lib/needle/interceptor.rb, line 177</span>
177:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>( <span class="ruby-identifier">name</span> )
178:       <span class="ruby-ivar">@options</span>[ <span class="ruby-identifier">name</span> ]
179:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000107" class="method-detail">
        <a name="M000107"></a>

        <div class="method-heading">
          <a href="#M000107" class="method-signature">
          <span class="method-name">[]=</span><span class="method-args">( name, value )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
A convenience method for setting the options on an interceptor definition.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000107-source">
<pre>
     <span class="ruby-comment cmt"># File lib/needle/interceptor.rb, line 183</span>
183:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>( <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span> )
184:       <span class="ruby-ivar">@options</span>[ <span class="ruby-identifier">name</span> ] = <span class="ruby-identifier">value</span>
185:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000101" class="method-detail">
        <a name="M000101"></a>

        <div class="method-heading">
          <a href="#M000101" class="method-signature">
          <span class="method-name">action</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the action that was specified for this interceptor as a proc
instance. This will either be the block passed to <a
href="Interceptor.html#M000102">with</a>, or a proc that wraps the
instantiation of a <a
href="Interceptor/DynamicInterceptor.html">DynamicInterceptor</a> (when <a
href="Interceptor.html#M000104">doing</a> was used).
</p>
<p>
If neither <a href="Interceptor.html#M000102">with</a> nor <a
href="Interceptor.html#M000104">doing</a> were specified, an <a
href="InterceptorConfigurationError.html">InterceptorConfigurationError</a>
is raised.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000101-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000101-source">
<pre>
    <span class="ruby-comment cmt"># File lib/needle/interceptor.rb, line 93</span>
93:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">action</span>
94:       <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@with</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@with</span>
95:       <span class="ruby-identifier">raise</span> <span class="ruby-constant">InterceptorConfigurationError</span>,
96:         <span class="ruby-value str">&quot;You must specify either 'with' or 'doing'&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@doing</span>
97: 
98:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">proc</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-constant">DynamicInterceptor</span>.<span class="ruby-identifier">new</span>( <span class="ruby-ivar">@doing</span> ) }
99:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000104" class="method-detail">
        <a name="M000104"></a>

        <div class="method-heading">
          <a href="#M000104" class="method-signature">
          <span class="method-name">doing</span><span class="method-args">( &amp;block )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This allows new interceptors to be defined &quot;on-the-fly&quot;. The
associated block must accept two parameters&#8212;an object representing
the chain of interceptors, and the context of the current method
invocation. The block should then invoke process_next on the chain (passing
the context as the lone parameter) when the next element of the chain
should be invoked.
</p>
<p>
You should only call <a href="Interceptor.html#M000104">doing</a> once per
interceptor, and never after invoking <a
href="Interceptor.html#M000102">with</a> on the same interceptor.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000104-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000104-source">
<pre>
     <span class="ruby-comment cmt"># File lib/needle/interceptor.rb, line 149</span>
149:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">doing</span>( <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> )
150:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@doing</span>
151:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InterceptorConfigurationError</span>,
152:           <span class="ruby-value str">&quot;you cannot redefine 'doing' behavior&quot;</span>
153:       <span class="ruby-keyword kw">end</span>
154: 
155:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@with</span>
156:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InterceptorConfigurationError</span>,
157:           <span class="ruby-value str">&quot;cannot specify 'doing' after specifying 'with'&quot;</span>
158:       <span class="ruby-keyword kw">end</span>
159: 
160:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
161:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InterceptorConfigurationError</span>,
162:           <span class="ruby-value str">&quot;you must specify a block to 'doing'&quot;</span>
163:       <span class="ruby-keyword kw">end</span>
164: 
165:       <span class="ruby-ivar">@doing</span> = <span class="ruby-identifier">block</span>
166:       <span class="ruby-keyword kw">self</span>
167:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000102" class="method-detail">
        <a name="M000102"></a>

        <div class="method-heading">
          <a href="#M000102" class="method-signature">
          <span class="method-name">with</span><span class="method-args">( &amp;block )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets the action for this interceptor to be that defined by the interceptor
returned when the block is executed. You can only invoke <a
href="Interceptor.html#M000102">with</a> once, and never after previously
invoking <a href="Interceptor.html#M000104">doing</a> on the same
interceptor instance.
</p>
<p>
Usage:
</p>
<pre>
  container.intercept( :foo ).
    with { |c| c.logging_interceptor }
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000102-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000102-source">
<pre>
     <span class="ruby-comment cmt"># File lib/needle/interceptor.rb, line 110</span>
110:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with</span>( <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> )
111:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@with</span>
112:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InterceptorConfigurationError</span>,
113:           <span class="ruby-value str">&quot;you cannot redefine 'with' behavior&quot;</span>
114:       <span class="ruby-keyword kw">end</span>
115: 
116:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@doing</span>
117:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InterceptorConfigurationError</span>,
118:           <span class="ruby-value str">&quot;cannot specify 'with' after specifying 'doing'&quot;</span>
119:       <span class="ruby-keyword kw">end</span>
120: 
121:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
122:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InterceptorConfigurationError</span>,
123:           <span class="ruby-value str">&quot;you must specify a block to 'with'&quot;</span>
124:       <span class="ruby-keyword kw">end</span>
125: 
126:       <span class="ruby-ivar">@with</span> = <span class="ruby-identifier">block</span>
127:       <span class="ruby-keyword kw">self</span>
128:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000103" class="method-detail">
        <a name="M000103"></a>

        <div class="method-heading">
          <a href="#M000103" class="method-signature">
          <span class="method-name">with!</span><span class="method-args">( &amp;block )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This is identical to <a href="Interceptor.html#M000102">with</a>, but it
wraps the block in another proc that calls <tt>instance_eval</tt> on the
container, with the block.
</p>
<p>
Usage:
</p>
<pre>
  container.intercept( :foo ).
    with! { logging_interceptor }
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000103-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000103-source">
<pre>
     <span class="ruby-comment cmt"># File lib/needle/interceptor.rb, line 137</span>
137:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with!</span>( <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> )
138:       <span class="ruby-identifier">with</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">instance_eval</span>( <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> ) }
139:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000105" class="method-detail">
        <a name="M000105"></a>

        <div class="method-heading">
          <a href="#M000105" class="method-signature">
          <span class="method-name">with_options</span><span class="method-args">( opts={} )</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Merge the given <tt>opts</tt> hash into the interceptors options hash.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000105-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000105-source">
<pre>
     <span class="ruby-comment cmt"># File lib/needle/interceptor.rb, line 170</span>
170:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_options</span>( <span class="ruby-identifier">opts</span>={} )
171:       <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">update</span> <span class="ruby-identifier">opts</span>
172:       <span class="ruby-keyword kw">self</span>
173:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>