public
Rubygem
Description: Official repository for YARD: Yay! A Ruby Documentation-tool.
Homepage: http://yard.soen.ca / IRC: #yard on irc.freenode.net
Clone URL: git://github.com/lsegal/yard.git
Search Repo:
Click here to lend your support to: yard and make a donation at www.pledgie.com !
Delegate to a singleton Array
wycats (author)
Wed May 14 18:36:00 -0700 2008
commit  be82233018b2fc1eb0dfd8596f927a22e3e5e6f9
tree    a88232db49ead8366e7ccd72971f78021b511144
parent  5792b67d3a0b116f66d73e366caee02d80af94d7
...
 
 
1
2
3
 
4
5
 
 
 
 
6
7
 
 
 
 
8
9
10
 
11
12
 
13
14
15
...
19
20
21
22
23
24
25
26
...
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
...
29
30
31
 
 
32
33
34
0
@@ -1,15 +1,25 @@
0
+require "delegate"
0
+
0
 module YARD
0
   module CodeObjects
0
- class CodeObjectList < Array
0
+ class CodeObjectList < Delegator
0
       def initialize(owner)
0
         @owner = owner
0
+ @list = []
0
+ class << @list
0
+ undef :unshift
0
+ end
0
       end
0
       
0
+ def __getobj__
0
+ @list
0
+ end
0
+
0
       def <<(value)
0
         if value.is_a?(CodeObjects::Base) || value.is_a?(Proxy)
0
- super unless include?(value)
0
+ @list << value unless @list.include?(value)
0
         elsif value.is_a?(String) || value.is_a?(Symbol)
0
- super P(@owner, value) unless include?(P(@owner, value))
0
+ @list << P(@owner, value) unless @list.include?(P(@owner, value))
0
         else
0
           raise ArgumentError, "#{value.class} is not a valid CodeObject"
0
         end
0
@@ -19,8 +29,6 @@
0
       def push(value)
0
         self << value
0
       end
0
-
0
- undef :unshift if methods.include?("unshift") || methods.include?(:unshift)
0
     end
0
     
0
     NSEP = '::'

Comments

    No one has commented yet.