functor 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/functor.rb +81 -51
- data/metrics/benchmark.rb +39 -0
- data/metrics/helpers.rb +6 -0
- data/metrics/many_args.rb +71 -0
- data/metrics/one_arg.rb +61 -0
- data/test/fib.rb +2 -2
- data/test/functor.rb +6 -4
- data/test/guards.rb +2 -2
- data/test/inheritance.rb +13 -8
- data/test/matchers.rb +4 -4
- data/test/reopening.rb +3 -3
- data/test/supplement.rb +20 -0
- data/test/wildcard.rb +15 -0
- data/test/with_self.rb +8 -3
- metadata +12 -35
- data/doc/README +0 -71
- data/doc/rdoc/classes/Functor.html +0 -207
- data/doc/rdoc/classes/Functor.src/M000001.html +0 -18
- data/doc/rdoc/classes/Functor.src/M000002.html +0 -19
- data/doc/rdoc/classes/Functor.src/M000003.html +0 -18
- data/doc/rdoc/classes/Functor.src/M000004.html +0 -19
- data/doc/rdoc/classes/Functor.src/M000005.html +0 -16
- data/doc/rdoc/classes/Functor/Method.html +0 -131
- data/doc/rdoc/classes/Functor/Method.src/M000006.html +0 -25
- data/doc/rdoc/classes/Object.html +0 -147
- data/doc/rdoc/classes/Object.src/M000007.html +0 -25
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/doc/HISTORY.html +0 -111
- data/doc/rdoc/files/doc/README.html +0 -210
- data/doc/rdoc/files/lib/functor_rb.html +0 -108
- data/doc/rdoc/files/lib/object_rb.html +0 -101
- data/doc/rdoc/fr_class_index.html +0 -29
- data/doc/rdoc/fr_file_index.html +0 -30
- data/doc/rdoc/fr_method_index.html +0 -33
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/lib/object.rb +0 -17
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>new (Functor)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/functor.rb, line 31</span>
|
14
|
-
31: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span><span class="ruby-identifier">initialize</span><span class="ruby-identifier">initialize</span>( <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
15
|
-
32: <span class="ruby-ivar">@rules</span> = [] ; <span class="ruby-identifier">instance_eval</span>( <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> ) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
16
|
-
33: <span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>given (Functor)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/functor.rb, line 35</span>
|
14
|
-
35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">given</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">pattern</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">action</span> )
|
15
|
-
36: <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>,<span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">pattern</span> }
|
16
|
-
37: <span class="ruby-ivar">@rules</span> <span class="ruby-operator"><<</span> [ <span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">action</span> ]
|
17
|
-
38: <span class="ruby-keyword kw">end</span></pre>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>apply (Functor)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/functor.rb, line 40</span>
|
14
|
-
40: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply</span>( <span class="ruby-identifier">object</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
15
|
-
41: <span class="ruby-identifier">object</span>.<span class="ruby-identifier">instance_exec</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">match</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> ) )
|
16
|
-
42: <span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>call (Functor)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/functor.rb, line 44</span>
|
14
|
-
44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
15
|
-
45: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">push</span>( <span class="ruby-identifier">block</span> ) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
16
|
-
46: <span class="ruby-identifier">match</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> ).<span class="ruby-identifier">call</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
17
|
-
47: <span class="ruby-keyword kw">end</span></pre>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>to_proc (Functor)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/functor.rb, line 49</span>
|
14
|
-
49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_proc</span> ; <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">call</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> ) } ; <span class="ruby-keyword kw">end</span></pre>
|
15
|
-
</body>
|
16
|
-
</html>
|
@@ -1,131 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Module: Functor::Method</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">Functor::Method</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/functor_rb.html">
|
59
|
-
lib/functor.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="method-list">
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
81
|
-
|
82
|
-
<div class="name-list">
|
83
|
-
<a href="#M000006">included</a>
|
84
|
-
</div>
|
85
|
-
</div>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
|
90
|
-
<!-- if includes -->
|
91
|
-
|
92
|
-
<div id="section">
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
<!-- if method_list -->
|
102
|
-
<div id="methods">
|
103
|
-
<h3 class="section-bar">Public Class methods</h3>
|
104
|
-
|
105
|
-
<div id="method-M000006" class="method-detail">
|
106
|
-
<a name="M000006"></a>
|
107
|
-
|
108
|
-
<div class="method-heading">
|
109
|
-
<a href="Method.src/M000006.html" target="Code" class="method-signature"
|
110
|
-
onclick="popupCode('Method.src/M000006.html');return false;">
|
111
|
-
<span class="method-name">included</span><span class="method-args">( k )</span>
|
112
|
-
</a>
|
113
|
-
</div>
|
114
|
-
|
115
|
-
<div class="method-description">
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
|
119
|
-
|
120
|
-
</div>
|
121
|
-
|
122
|
-
|
123
|
-
</div>
|
124
|
-
|
125
|
-
|
126
|
-
<div id="validator-badges">
|
127
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
</body>
|
131
|
-
</html>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>included (Functor::Method)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/functor.rb, line 6</span>
|
14
|
-
6: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>( <span class="ruby-identifier">k</span> )
|
15
|
-
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">functors</span> ; <span class="ruby-ivar">@__functors</span> <span class="ruby-operator">||=</span> {} ; <span class="ruby-keyword kw">end</span>
|
16
|
-
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">functor</span>( <span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
17
|
-
9: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">functors</span>[ <span class="ruby-identifier">name</span> ]
|
18
|
-
10: <span class="ruby-identifier">functors</span>[ <span class="ruby-identifier">name</span> ] = <span class="ruby-constant">Functor</span>.<span class="ruby-identifier">new</span>
|
19
|
-
11: <span class="ruby-identifier">klass</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span> ; <span class="ruby-identifier">module_eval</span> <span class="ruby-value str">"def \#{name}( *args, &block )\nbegin\n\#{klass}.functors[ :\#{name} ].apply( self, *args, &block )\nrescue ArgumentError => e\nbegin\nsuper\nrescue NoMethodError => f\nraise e\nend\nend\nend\n"</span>
|
20
|
-
12: <span class="ruby-keyword kw">end</span>
|
21
|
-
13: <span class="ruby-identifier">functors</span>[ <span class="ruby-identifier">name</span> ].<span class="ruby-identifier">given</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
22
|
-
14: <span class="ruby-keyword kw">end</span>
|
23
|
-
15: <span class="ruby-keyword kw">end</span></pre>
|
24
|
-
</body>
|
25
|
-
</html>
|
@@ -1,147 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Object</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Object</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/object_rb.html">
|
59
|
-
lib/object.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
<a href="Object.html">
|
69
|
-
Object
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
</div>
|
86
|
-
|
87
|
-
<div id="method-list">
|
88
|
-
<h3 class="section-bar">Methods</h3>
|
89
|
-
|
90
|
-
<div class="name-list">
|
91
|
-
<a href="#M000007">instance_exec</a>
|
92
|
-
</div>
|
93
|
-
</div>
|
94
|
-
|
95
|
-
</div>
|
96
|
-
|
97
|
-
|
98
|
-
<!-- if includes -->
|
99
|
-
|
100
|
-
<div id="section">
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
<!-- if method_list -->
|
110
|
-
<div id="methods">
|
111
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
112
|
-
|
113
|
-
<div id="method-M000007" class="method-detail">
|
114
|
-
<a name="M000007"></a>
|
115
|
-
|
116
|
-
<div class="method-heading">
|
117
|
-
<a href="Object.src/M000007.html" target="Code" class="method-signature"
|
118
|
-
onclick="popupCode('Object.src/M000007.html');return false;">
|
119
|
-
<span class="method-name">instance_exec</span><span class="method-args">(*args, &block)</span>
|
120
|
-
</a>
|
121
|
-
</div>
|
122
|
-
|
123
|
-
<div class="method-description">
|
124
|
-
<p>
|
125
|
-
This is an extremely powerful little function that will be built-in to Ruby
|
126
|
-
1.9. This version is from Mauricio Fernandez via ruby-talk. Works like
|
127
|
-
instance_eval except that you can pass parameters to the block. This means
|
128
|
-
you can define a block intended for use with instance_eval, pass it to
|
129
|
-
another method, which can then invoke with parameters. This is used quite a
|
130
|
-
bit by the Waves::Mapping code.
|
131
|
-
</p>
|
132
|
-
</div>
|
133
|
-
</div>
|
134
|
-
|
135
|
-
|
136
|
-
</div>
|
137
|
-
|
138
|
-
|
139
|
-
</div>
|
140
|
-
|
141
|
-
|
142
|
-
<div id="validator-badges">
|
143
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
144
|
-
</div>
|
145
|
-
|
146
|
-
</body>
|
147
|
-
</html>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>instance_exec (Object)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/object.rb, line 7</span>
|
14
|
-
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instance_exec</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
-
8: <span class="ruby-identifier">mname</span> = <span class="ruby-node">"__instance_exec_#{Thread.current.object_id.abs}"</span>
|
16
|
-
9: <span class="ruby-keyword kw">class</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>; <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">class_eval</span>{ <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">mname</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) }
|
17
|
-
10: <span class="ruby-keyword kw">begin</span>
|
18
|
-
11: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">send</span>(<span class="ruby-identifier">mname</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
19
|
-
12: <span class="ruby-keyword kw">ensure</span>
|
20
|
-
13: <span class="ruby-keyword kw">class</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>; <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">class_eval</span>{ <span class="ruby-identifier">undef_method</span>(<span class="ruby-identifier">mname</span>) } <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
21
|
-
14: <span class="ruby-keyword kw">end</span>
|
22
|
-
15: <span class="ruby-identifier">ret</span>
|
23
|
-
16: <span class="ruby-keyword kw">end</span></pre>
|
24
|
-
</body>
|
25
|
-
</html>
|
data/doc/rdoc/created.rid
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Mon, 16 Jun 2008 10:19:27 -0700
|
@@ -1,111 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>File: HISTORY</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="fileHeader">
|
50
|
-
<h1>HISTORY</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>doc/HISTORY
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Sun Jun 15 18:02:06 -0700 2008</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<p>
|
73
|
-
0.1 - Initial implemention of <a
|
74
|
-
href="../../classes/Functor.html">Functor</a> class. 0.2 - Added method
|
75
|
-
dispatch, to_proc support, tests. 0.3 - Added support for guards and
|
76
|
-
redefinition. 0.3.1 - Made thread-safe and added ability to call base class
|
77
|
-
functors.
|
78
|
-
</p>
|
79
|
-
|
80
|
-
</div>
|
81
|
-
|
82
|
-
|
83
|
-
</div>
|
84
|
-
|
85
|
-
|
86
|
-
</div>
|
87
|
-
|
88
|
-
|
89
|
-
<!-- if includes -->
|
90
|
-
|
91
|
-
<div id="section">
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
<!-- if method_list -->
|
101
|
-
|
102
|
-
|
103
|
-
</div>
|
104
|
-
|
105
|
-
|
106
|
-
<div id="validator-badges">
|
107
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
108
|
-
</div>
|
109
|
-
|
110
|
-
</body>
|
111
|
-
</html>
|