formattedstring 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +16 -0
- data/README +57 -0
- data/Rakefile +79 -0
- data/doc/classes/Enumerable.html +146 -0
- data/doc/classes/Enumerable.src/M000025.html +21 -0
- data/doc/classes/Enumerable.src/M000026.html +34 -0
- data/doc/classes/FormattedString/Formats/Xml.html +144 -0
- data/doc/classes/FormattedString/Formats/Xml.src/M000004.html +49 -0
- data/doc/classes/FormattedString/Formats.html +111 -0
- data/doc/classes/FormattedString.html +111 -0
- data/doc/classes/Inflector/Inflections.html +321 -0
- data/doc/classes/Inflector/Inflections.src/M000019.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000020.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000021.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000022.html +26 -0
- data/doc/classes/Inflector/Inflections.src/M000023.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000024.html +23 -0
- data/doc/classes/Inflector.html +516 -0
- data/doc/classes/Inflector.src/M000005.html +22 -0
- data/doc/classes/Inflector.src/M000006.html +25 -0
- data/doc/classes/Inflector.src/M000007.html +25 -0
- data/doc/classes/Inflector.src/M000008.html +22 -0
- data/doc/classes/Inflector.src/M000009.html +18 -0
- data/doc/classes/Inflector.src/M000010.html +22 -0
- data/doc/classes/Inflector.src/M000011.html +18 -0
- data/doc/classes/Inflector.src/M000012.html +18 -0
- data/doc/classes/Inflector.src/M000013.html +18 -0
- data/doc/classes/Inflector.src/M000014.html +18 -0
- data/doc/classes/Inflector.src/M000015.html +19 -0
- data/doc/classes/Inflector.src/M000016.html +18 -0
- data/doc/classes/Inflector.src/M000017.html +22 -0
- data/doc/classes/Inflector.src/M000018.html +27 -0
- data/doc/classes/String.html +191 -0
- data/doc/classes/String.src/M000001.html +18 -0
- data/doc/classes/String.src/M000002.html +20 -0
- data/doc/classes/String.src/M000003.html +19 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +129 -0
- data/doc/files/README.html +196 -0
- data/doc/files/lib/formatted_string/formats/xml_rb.html +119 -0
- data/doc/files/lib/formatted_string_rb.html +108 -0
- data/doc/files/lib/inflections_rb.html +101 -0
- data/doc/files/lib/inflector_rb.html +108 -0
- data/doc/fr_class_index.html +33 -0
- data/doc/fr_file_index.html +32 -0
- data/doc/fr_method_index.html +52 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/formatted_string/formats/xml.rb +163 -0
- data/lib/formatted_string.rb +34 -0
- data/lib/inflections.rb +53 -0
- data/lib/inflector.rb +282 -0
- metadata +120 -0
@@ -0,0 +1,111 @@
|
|
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: FormattedString::Formats</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">FormattedString::Formats</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/formatted_string/formats/xml_rb.html">
|
59
|
+
lib/formatted_string/formats/xml.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
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
<!-- if includes -->
|
84
|
+
|
85
|
+
<div id="section">
|
86
|
+
|
87
|
+
<div id="class-list">
|
88
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
89
|
+
|
90
|
+
Module <a href="Formats/Xml.html" class="link">FormattedString::Formats::Xml</a><br />
|
91
|
+
|
92
|
+
</div>
|
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>
|
@@ -0,0 +1,111 @@
|
|
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: FormattedString</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">FormattedString</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/formatted_string/formats/xml_rb.html">
|
59
|
+
lib/formatted_string/formats/xml.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
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
<!-- if includes -->
|
84
|
+
|
85
|
+
<div id="section">
|
86
|
+
|
87
|
+
<div id="class-list">
|
88
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
89
|
+
|
90
|
+
Module <a href="FormattedString/Formats.html" class="link">FormattedString::Formats</a><br />
|
91
|
+
|
92
|
+
</div>
|
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>
|
@@ -0,0 +1,321 @@
|
|
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: Inflector::Inflections</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">Inflector::Inflections</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/inflector_rb.html">
|
59
|
+
lib/inflector.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
|
+
Object
|
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
|
+
A singleton instance of this class is yielded by <a
|
84
|
+
href="../Inflector.html#M000005">Inflector.inflections</a>, which can then
|
85
|
+
be used to specify additional inflection rules. Examples:
|
86
|
+
</p>
|
87
|
+
<pre>
|
88
|
+
Inflector.inflections do |inflect|
|
89
|
+
inflect.plural /^(ox)$/i, '\1\2en'
|
90
|
+
inflect.singular /^(ox)en/i, '\1'
|
91
|
+
|
92
|
+
inflect.irregular 'octopus', 'octopi'
|
93
|
+
|
94
|
+
inflect.uncountable "equipment"
|
95
|
+
end
|
96
|
+
</pre>
|
97
|
+
<p>
|
98
|
+
New rules are added at the top. So in the example above, the <a
|
99
|
+
href="Inflections.html#M000022">irregular</a> rule for octopus will now be
|
100
|
+
the first of the pluralization and singularization rules that is runs. This
|
101
|
+
guarantees that your rules run before any of the rules that may already
|
102
|
+
have been loaded.
|
103
|
+
</p>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
<div id="method-list">
|
111
|
+
<h3 class="section-bar">Methods</h3>
|
112
|
+
|
113
|
+
<div class="name-list">
|
114
|
+
<a href="#M000024">clear</a>
|
115
|
+
<a href="#M000022">irregular</a>
|
116
|
+
<a href="#M000019">new</a>
|
117
|
+
<a href="#M000020">plural</a>
|
118
|
+
<a href="#M000021">singular</a>
|
119
|
+
<a href="#M000023">uncountable</a>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
</div>
|
124
|
+
|
125
|
+
|
126
|
+
<!-- if includes -->
|
127
|
+
<div id="includes">
|
128
|
+
<h3 class="section-bar">Included Modules</h3>
|
129
|
+
|
130
|
+
<div id="includes-list">
|
131
|
+
<span class="include-name">Singleton</span>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<div id="section">
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<div id="attribute-list">
|
142
|
+
<h3 class="section-bar">Attributes</h3>
|
143
|
+
|
144
|
+
<div class="name-list">
|
145
|
+
<table>
|
146
|
+
<tr class="top-aligned-row context-row">
|
147
|
+
<td class="context-item-name">plurals</td>
|
148
|
+
<td class="context-item-value"> [R] </td>
|
149
|
+
<td class="context-item-desc"></td>
|
150
|
+
</tr>
|
151
|
+
<tr class="top-aligned-row context-row">
|
152
|
+
<td class="context-item-name">singulars</td>
|
153
|
+
<td class="context-item-value"> [R] </td>
|
154
|
+
<td class="context-item-desc"></td>
|
155
|
+
</tr>
|
156
|
+
<tr class="top-aligned-row context-row">
|
157
|
+
<td class="context-item-name">uncountables</td>
|
158
|
+
<td class="context-item-value"> [R] </td>
|
159
|
+
<td class="context-item-desc"></td>
|
160
|
+
</tr>
|
161
|
+
</table>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<!-- if method_list -->
|
168
|
+
<div id="methods">
|
169
|
+
<h3 class="section-bar">Public Class methods</h3>
|
170
|
+
|
171
|
+
<div id="method-M000019" class="method-detail">
|
172
|
+
<a name="M000019"></a>
|
173
|
+
|
174
|
+
<div class="method-heading">
|
175
|
+
<a href="Inflections.src/M000019.html" target="Code" class="method-signature"
|
176
|
+
onclick="popupCode('Inflections.src/M000019.html');return false;">
|
177
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
178
|
+
</a>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div class="method-description">
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
186
|
+
|
187
|
+
<div id="method-M000024" class="method-detail">
|
188
|
+
<a name="M000024"></a>
|
189
|
+
|
190
|
+
<div class="method-heading">
|
191
|
+
<a href="Inflections.src/M000024.html" target="Code" class="method-signature"
|
192
|
+
onclick="popupCode('Inflections.src/M000024.html');return false;">
|
193
|
+
<span class="method-name">clear</span><span class="method-args">(scope = :all)</span>
|
194
|
+
</a>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div class="method-description">
|
198
|
+
<p>
|
199
|
+
Clears the loaded inflections within a given scope (default is :all). Give
|
200
|
+
the scope as a symbol of the inflection type, the options are: :plurals,
|
201
|
+
:singulars, :uncountables
|
202
|
+
</p>
|
203
|
+
<p>
|
204
|
+
Examples:
|
205
|
+
</p>
|
206
|
+
<pre>
|
207
|
+
clear :all
|
208
|
+
clear :plurals
|
209
|
+
</pre>
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<div id="method-M000022" class="method-detail">
|
214
|
+
<a name="M000022"></a>
|
215
|
+
|
216
|
+
<div class="method-heading">
|
217
|
+
<a href="Inflections.src/M000022.html" target="Code" class="method-signature"
|
218
|
+
onclick="popupCode('Inflections.src/M000022.html');return false;">
|
219
|
+
<span class="method-name">irregular</span><span class="method-args">(singular, plural)</span>
|
220
|
+
</a>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
<div class="method-description">
|
224
|
+
<p>
|
225
|
+
Specifies a <a href="Inflections.html#M000019">new</a> <a
|
226
|
+
href="Inflections.html#M000022">irregular</a> that applies to both
|
227
|
+
pluralization and singularization at the same time. This can only be used
|
228
|
+
for strings, not regular expressions. You simply pass the <a
|
229
|
+
href="Inflections.html#M000022">irregular</a> in <a
|
230
|
+
href="Inflections.html#M000021">singular</a> and <a
|
231
|
+
href="Inflections.html#M000020">plural</a> form.
|
232
|
+
</p>
|
233
|
+
<p>
|
234
|
+
Examples:
|
235
|
+
</p>
|
236
|
+
<pre>
|
237
|
+
irregular 'octopus', 'octopi'
|
238
|
+
irregular 'person', 'people'
|
239
|
+
</pre>
|
240
|
+
</div>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div id="method-M000020" class="method-detail">
|
244
|
+
<a name="M000020"></a>
|
245
|
+
|
246
|
+
<div class="method-heading">
|
247
|
+
<a href="Inflections.src/M000020.html" target="Code" class="method-signature"
|
248
|
+
onclick="popupCode('Inflections.src/M000020.html');return false;">
|
249
|
+
<span class="method-name">plural</span><span class="method-args">(rule, replacement)</span>
|
250
|
+
</a>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
<div class="method-description">
|
254
|
+
<p>
|
255
|
+
Specifies a <a href="Inflections.html#M000019">new</a> pluralization rule
|
256
|
+
and its replacement. The rule can either be a string or a regular
|
257
|
+
expression. The replacement should always be a string that may include
|
258
|
+
references to the matched data from the rule.
|
259
|
+
</p>
|
260
|
+
</div>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<div id="method-M000021" class="method-detail">
|
264
|
+
<a name="M000021"></a>
|
265
|
+
|
266
|
+
<div class="method-heading">
|
267
|
+
<a href="Inflections.src/M000021.html" target="Code" class="method-signature"
|
268
|
+
onclick="popupCode('Inflections.src/M000021.html');return false;">
|
269
|
+
<span class="method-name">singular</span><span class="method-args">(rule, replacement)</span>
|
270
|
+
</a>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<div class="method-description">
|
274
|
+
<p>
|
275
|
+
Specifies a <a href="Inflections.html#M000019">new</a> singularization rule
|
276
|
+
and its replacement. The rule can either be a string or a regular
|
277
|
+
expression. The replacement should always be a string that may include
|
278
|
+
references to the matched data from the rule.
|
279
|
+
</p>
|
280
|
+
</div>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
<div id="method-M000023" class="method-detail">
|
284
|
+
<a name="M000023"></a>
|
285
|
+
|
286
|
+
<div class="method-heading">
|
287
|
+
<a href="Inflections.src/M000023.html" target="Code" class="method-signature"
|
288
|
+
onclick="popupCode('Inflections.src/M000023.html');return false;">
|
289
|
+
<span class="method-name">uncountable</span><span class="method-args">(*words)</span>
|
290
|
+
</a>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<div class="method-description">
|
294
|
+
<p>
|
295
|
+
Add <a href="Inflections.html#M000023">uncountable</a> words that
|
296
|
+
shouldn‘t be attempted inflected.
|
297
|
+
</p>
|
298
|
+
<p>
|
299
|
+
Examples:
|
300
|
+
</p>
|
301
|
+
<pre>
|
302
|
+
uncountable "money"
|
303
|
+
uncountable "money", "information"
|
304
|
+
uncountable %w( money information rice )
|
305
|
+
</pre>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
|
310
|
+
</div>
|
311
|
+
|
312
|
+
|
313
|
+
</div>
|
314
|
+
|
315
|
+
|
316
|
+
<div id="validator-badges">
|
317
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
318
|
+
</div>
|
319
|
+
|
320
|
+
</body>
|
321
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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 (Inflector::Inflections)</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/inflector.rb, line 27</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
15
|
+
<span class="ruby-ivar">@plurals</span>, <span class="ruby-ivar">@singulars</span>, <span class="ruby-ivar">@uncountables</span> = [], [], []
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>plural (Inflector::Inflections)</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/inflector.rb, line 33</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">plural</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
|
15
|
+
<span class="ruby-ivar">@plurals</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, [<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>])
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>singular (Inflector::Inflections)</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/inflector.rb, line 39</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singular</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
|
15
|
+
<span class="ruby-ivar">@singulars</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, [<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>])
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
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>irregular (Inflector::Inflections)</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/inflector.rb, line 49</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">irregular</span>(<span class="ruby-identifier">singular</span>, <span class="ruby-identifier">plural</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">singular</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>].<span class="ruby-identifier">upcase</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">plural</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>].<span class="ruby-identifier">upcase</span>
|
16
|
+
<span class="ruby-identifier">plural</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"(#{singular[0,1]})#{singular[1..-1]}$"</span>, <span class="ruby-value str">"i"</span>), <span class="ruby-value str">'\1'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">plural</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
17
|
+
<span class="ruby-identifier">singular</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"(#{plural[0,1]})#{plural[1..-1]}$"</span>, <span class="ruby-value str">"i"</span>), <span class="ruby-value str">'\1'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">singular</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
18
|
+
<span class="ruby-keyword kw">else</span>
|
19
|
+
<span class="ruby-identifier">plural</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"</span>), <span class="ruby-identifier">plural</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>].<span class="ruby-identifier">upcase</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">plural</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
20
|
+
<span class="ruby-identifier">plural</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"</span>), <span class="ruby-identifier">plural</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>].<span class="ruby-identifier">downcase</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">plural</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
21
|
+
<span class="ruby-identifier">singular</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"</span>), <span class="ruby-identifier">singular</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>].<span class="ruby-identifier">upcase</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">singular</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
22
|
+
<span class="ruby-identifier">singular</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"</span>), <span class="ruby-identifier">singular</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>].<span class="ruby-identifier">downcase</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">singular</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
23
|
+
<span class="ruby-keyword kw">end</span>
|
24
|
+
<span class="ruby-keyword kw">end</span></pre>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>uncountable (Inflector::Inflections)</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/inflector.rb, line 67</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uncountable</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">words</span>)
|
15
|
+
(<span class="ruby-ivar">@uncountables</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">words</span>).<span class="ruby-identifier">flatten!</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|