mack_ruby_core_extensions 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/Array.html +465 -0
- data/doc/classes/Class.html +233 -0
- data/doc/classes/Float.html +148 -0
- data/doc/classes/Hash.html +232 -0
- data/doc/classes/Kernel.html +184 -0
- data/doc/classes/Mack/Utils/Inflector.html +422 -0
- data/doc/classes/Math.html +188 -0
- data/doc/classes/MethodNotImplemented.html +155 -0
- data/doc/classes/Module.html +203 -0
- data/doc/classes/NilClass.html +151 -0
- data/doc/classes/Object.html +448 -0
- data/doc/classes/String.html +977 -0
- data/doc/classes/Symbol.html +148 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +151 -0
- data/doc/files/lib/extensions/array_rb.html +101 -0
- data/doc/files/lib/extensions/class_rb.html +101 -0
- data/doc/files/lib/extensions/float_rb.html +101 -0
- data/doc/files/lib/extensions/hash_rb.html +108 -0
- data/doc/files/lib/extensions/kernel_rb.html +109 -0
- data/doc/files/lib/extensions/math_rb.html +101 -0
- data/doc/files/lib/extensions/method_not_implemented_rb.html +108 -0
- data/doc/files/lib/extensions/module_rb.html +101 -0
- data/doc/files/lib/extensions/nil_rb.html +101 -0
- data/doc/files/lib/extensions/object_rb.html +101 -0
- data/doc/files/lib/extensions/string_rb.html +108 -0
- data/doc/files/lib/extensions/symbol_rb.html +101 -0
- data/doc/files/lib/mack_ruby_core_extensions_rb.html +101 -0
- data/doc/files/lib/utils/inflections_rb.html +101 -0
- data/doc/files/lib/utils/inflector_rb.html +108 -0
- data/doc/fr_class_index.html +39 -0
- data/doc/fr_file_index.html +42 -0
- data/doc/fr_method_index.html +96 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/extensions/class.rb +14 -0
- data/lib/extensions/object.rb +5 -0
- data/test/extensions/class_test.rb +10 -0
- metadata +37 -2
@@ -0,0 +1,188 @@
|
|
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: Math</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">Math</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/extensions/math_rb.html">
|
59
|
+
lib/extensions/math.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="#M000068">log2</a>
|
84
|
+
<a href="#M000070">max</a>
|
85
|
+
<a href="#M000069">min</a>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<!-- if includes -->
|
93
|
+
|
94
|
+
<div id="section">
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if method_list -->
|
104
|
+
<div id="methods">
|
105
|
+
<h3 class="section-bar">Public Class methods</h3>
|
106
|
+
|
107
|
+
<div id="method-M000068" class="method-detail">
|
108
|
+
<a name="M000068"></a>
|
109
|
+
|
110
|
+
<div class="method-heading">
|
111
|
+
<a href="#M000068" class="method-signature">
|
112
|
+
<span class="method-name">log2</span><span class="method-args">(x)</span>
|
113
|
+
</a>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div class="method-description">
|
117
|
+
<p><a class="source-toggle" href="#"
|
118
|
+
onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
|
119
|
+
<div class="method-source-code" id="M000068-source">
|
120
|
+
<pre>
|
121
|
+
<span class="ruby-comment cmt"># File lib/extensions/math.rb, line 3</span>
|
122
|
+
3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">log2</span>(<span class="ruby-identifier">x</span>)
|
123
|
+
4: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">x</span>)<span class="ruby-operator">/</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">log</span>(<span class="ruby-value">2.0</span>)
|
124
|
+
5: <span class="ruby-keyword kw">end</span>
|
125
|
+
</pre>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div id="method-M000070" class="method-detail">
|
131
|
+
<a name="M000070"></a>
|
132
|
+
|
133
|
+
<div class="method-heading">
|
134
|
+
<a href="#M000070" class="method-signature">
|
135
|
+
<span class="method-name">max</span><span class="method-args">(a, b)</span>
|
136
|
+
</a>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div class="method-description">
|
140
|
+
<p><a class="source-toggle" href="#"
|
141
|
+
onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
|
142
|
+
<div class="method-source-code" id="M000070-source">
|
143
|
+
<pre>
|
144
|
+
<span class="ruby-comment cmt"># File lib/extensions/math.rb, line 11</span>
|
145
|
+
11: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">max</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
|
146
|
+
12: <span class="ruby-identifier">a</span> <span class="ruby-operator">></span> <span class="ruby-identifier">b</span> <span class="ruby-value">? </span><span class="ruby-identifier">a</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">b</span>
|
147
|
+
13: <span class="ruby-keyword kw">end</span>
|
148
|
+
</pre>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div id="method-M000069" class="method-detail">
|
154
|
+
<a name="M000069"></a>
|
155
|
+
|
156
|
+
<div class="method-heading">
|
157
|
+
<a href="#M000069" class="method-signature">
|
158
|
+
<span class="method-name">min</span><span class="method-args">(a, b)</span>
|
159
|
+
</a>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div class="method-description">
|
163
|
+
<p><a class="source-toggle" href="#"
|
164
|
+
onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
|
165
|
+
<div class="method-source-code" id="M000069-source">
|
166
|
+
<pre>
|
167
|
+
<span class="ruby-comment cmt"># File lib/extensions/math.rb, line 7</span>
|
168
|
+
7: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
|
169
|
+
8: <span class="ruby-identifier">a</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">b</span> <span class="ruby-value">? </span><span class="ruby-identifier">a</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">b</span>
|
170
|
+
9: <span class="ruby-keyword kw">end</span>
|
171
|
+
</pre>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
</div>
|
181
|
+
|
182
|
+
|
183
|
+
<div id="validator-badges">
|
184
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
</body>
|
188
|
+
</html>
|
@@ -0,0 +1,155 @@
|
|
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: MethodNotImplemented</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">MethodNotImplemented</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/extensions/method_not_implemented_rb.html">
|
59
|
+
lib/extensions/method_not_implemented.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
|
+
Exception
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
This exception is thrown if there is a method that has not been implemented
|
84
|
+
that needs to be.
|
85
|
+
</p>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<div id="method-list">
|
93
|
+
<h3 class="section-bar">Methods</h3>
|
94
|
+
|
95
|
+
<div class="name-list">
|
96
|
+
<a href="#M000018">new</a>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if includes -->
|
104
|
+
|
105
|
+
<div id="section">
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<!-- if method_list -->
|
115
|
+
<div id="methods">
|
116
|
+
<h3 class="section-bar">Public Class methods</h3>
|
117
|
+
|
118
|
+
<div id="method-M000018" class="method-detail">
|
119
|
+
<a name="M000018"></a>
|
120
|
+
|
121
|
+
<div class="method-heading">
|
122
|
+
<a href="#M000018" class="method-signature">
|
123
|
+
<span class="method-name">new</span><span class="method-args">(meth, msg = nil)</span>
|
124
|
+
</a>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div class="method-description">
|
128
|
+
<p><a class="source-toggle" href="#"
|
129
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
130
|
+
<div class="method-source-code" id="M000018-source">
|
131
|
+
<pre>
|
132
|
+
<span class="ruby-comment cmt"># File lib/extensions/method_not_implemented.rb, line 6</span>
|
133
|
+
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">meth</span>, <span class="ruby-identifier">msg</span> = <span class="ruby-keyword kw">nil</span>)
|
134
|
+
7: <span class="ruby-identifier">mess</span> = <span class="ruby-node">"#{meth} has not been implemented!\nPlease implement this method!\nIf you do not understand what this method is supposed to do, please consult the RDoc for more information."</span>
|
135
|
+
8: <span class="ruby-identifier">mess</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"\n#{msg}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">nil?</span>
|
136
|
+
9: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">mess</span>)
|
137
|
+
10: <span class="ruby-keyword kw">end</span>
|
138
|
+
</pre>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
<div id="validator-badges">
|
151
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
</body>
|
155
|
+
</html>
|
@@ -0,0 +1,203 @@
|
|
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: Module</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">Module</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/extensions/module_rb.html">
|
59
|
+
lib/extensions/module.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="#M000016">convert_security_of_methods</a>
|
92
|
+
<a href="#M000017">include_safely_into</a>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<!-- if method_list -->
|
111
|
+
<div id="methods">
|
112
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
113
|
+
|
114
|
+
<div id="method-M000016" class="method-detail">
|
115
|
+
<a name="M000016"></a>
|
116
|
+
|
117
|
+
<div class="method-heading">
|
118
|
+
<a href="#M000016" class="method-signature">
|
119
|
+
<span class="method-name">convert_security_of_methods</span><span class="method-args">(old_level = :public, new_level = :protected)</span>
|
120
|
+
</a>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div class="method-description">
|
124
|
+
<p>
|
125
|
+
Bulk converts the security level of methods in this <a
|
126
|
+
href="Module.html">Module</a> from one level to another.
|
127
|
+
</p>
|
128
|
+
<p><a class="source-toggle" href="#"
|
129
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
130
|
+
<div class="method-source-code" id="M000016-source">
|
131
|
+
<pre>
|
132
|
+
<span class="ruby-comment cmt"># File lib/extensions/module.rb, line 4</span>
|
133
|
+
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_security_of_methods</span>(<span class="ruby-identifier">old_level</span> = <span class="ruby-identifier">:public</span>, <span class="ruby-identifier">new_level</span> = <span class="ruby-identifier">:protected</span>)
|
134
|
+
5: <span class="ruby-identifier">eval</span>(<span class="ruby-node">"#{old_level}_instance_methods"</span>).<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">new_level</span>, <span class="ruby-identifier">meth</span>) }
|
135
|
+
6: <span class="ruby-keyword kw">self</span>
|
136
|
+
7: <span class="ruby-keyword kw">end</span>
|
137
|
+
</pre>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div id="method-M000017" class="method-detail">
|
143
|
+
<a name="M000017"></a>
|
144
|
+
|
145
|
+
<div class="method-heading">
|
146
|
+
<a href="#M000017" class="method-signature">
|
147
|
+
<span class="method-name">include_safely_into</span><span class="method-args">(*args)</span>
|
148
|
+
</a>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div class="method-description">
|
152
|
+
<p>
|
153
|
+
Includes this module into an <a href="Object.html">Object</a>, and changes
|
154
|
+
all public methods to protected.
|
155
|
+
</p>
|
156
|
+
<p>
|
157
|
+
Examples:
|
158
|
+
</p>
|
159
|
+
<pre>
|
160
|
+
module MyCoolUtils
|
161
|
+
def some_meth
|
162
|
+
"hi"
|
163
|
+
end
|
164
|
+
self.include_safely_into(FooController)
|
165
|
+
end
|
166
|
+
</pre>
|
167
|
+
<p>
|
168
|
+
or:
|
169
|
+
</p>
|
170
|
+
<pre>
|
171
|
+
MyCoolUtils.include_safely_into(FooController, SomeOtherClass)
|
172
|
+
</pre>
|
173
|
+
<p><a class="source-toggle" href="#"
|
174
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
175
|
+
<div class="method-source-code" id="M000017-source">
|
176
|
+
<pre>
|
177
|
+
<span class="ruby-comment cmt"># File lib/extensions/module.rb, line 20</span>
|
178
|
+
20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include_safely_into</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
179
|
+
21: [<span class="ruby-identifier">args</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
|
180
|
+
22: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
|
181
|
+
23: <span class="ruby-identifier">a</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">constantize</span>
|
182
|
+
24: <span class="ruby-keyword kw">end</span>
|
183
|
+
25: <span class="ruby-identifier">a</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">convert_security_of_methods</span>)
|
184
|
+
26: <span class="ruby-keyword kw">end</span>
|
185
|
+
27: <span class="ruby-keyword kw">end</span>
|
186
|
+
</pre>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
|
192
|
+
</div>
|
193
|
+
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
|
198
|
+
<div id="validator-badges">
|
199
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
</body>
|
203
|
+
</html>
|