locale 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/ChangeLog +3 -0
  2. data/benchmark/benchmark.rb +34 -0
  3. data/benchmark/benchmark_2.0.1.txt +7 -0
  4. data/doc/classes/Locale.html +1244 -0
  5. data/doc/classes/Locale/Driver.html +374 -0
  6. data/doc/classes/Locale/Driver/CGI.html +536 -0
  7. data/doc/classes/Locale/Driver/Env.html +439 -0
  8. data/doc/classes/Locale/Driver/JRuby.html +389 -0
  9. data/doc/classes/Locale/Driver/Posix.html +430 -0
  10. data/doc/classes/Locale/Driver/Win32.html +398 -0
  11. data/doc/classes/Locale/Driver/Win32Table.html +355 -0
  12. data/doc/classes/Locale/Info.html +585 -0
  13. data/doc/classes/Locale/Info/Language.html +763 -0
  14. data/doc/classes/Locale/Info/Region.html +470 -0
  15. data/doc/classes/Locale/Tag.html +433 -0
  16. data/doc/classes/Locale/Tag/Cldr.html +523 -0
  17. data/doc/classes/Locale/Tag/Common.html +624 -0
  18. data/doc/classes/Locale/Tag/Irregular.html +423 -0
  19. data/doc/classes/Locale/Tag/Posix.html +612 -0
  20. data/doc/classes/Locale/Tag/Rfc.html +581 -0
  21. data/doc/classes/Locale/Tag/Simple.html +721 -0
  22. data/doc/classes/Locale/TagList.html +826 -0
  23. data/doc/classes/Locale/Util.html +506 -0
  24. data/doc/classes/Locale/Util/Memoizable.html +355 -0
  25. data/doc/created.rid +1 -0
  26. data/doc/files/ChangeLog.html +537 -0
  27. data/doc/files/README_rdoc.html +565 -0
  28. data/doc/files/lib/locale/driver/cgi_rb.html +341 -0
  29. data/doc/files/lib/locale/driver/env_rb.html +353 -0
  30. data/doc/files/lib/locale/driver/jruby_rb.html +353 -0
  31. data/doc/files/lib/locale/driver/posix_rb.html +341 -0
  32. data/doc/files/lib/locale/driver/win32_rb.html +348 -0
  33. data/doc/files/lib/locale/driver/win32_table_rb.html +341 -0
  34. data/doc/files/lib/locale/info/language_rb.html +352 -0
  35. data/doc/files/lib/locale/info/region_rb.html +352 -0
  36. data/doc/files/lib/locale/info_rb.html +353 -0
  37. data/doc/files/lib/locale/tag/cldr_rb.html +348 -0
  38. data/doc/files/lib/locale/tag/common_rb.html +348 -0
  39. data/doc/files/lib/locale/tag/irregular_rb.html +348 -0
  40. data/doc/files/lib/locale/tag/posix_rb.html +341 -0
  41. data/doc/files/lib/locale/tag/rfc_rb.html +348 -0
  42. data/doc/files/lib/locale/tag/simple_rb.html +348 -0
  43. data/doc/files/lib/locale/tag_rb.html +378 -0
  44. data/doc/files/lib/locale/taglist_rb.html +348 -0
  45. data/doc/files/lib/locale/util/memoizable_rb.html +359 -0
  46. data/doc/files/lib/locale/version_rb.html +341 -0
  47. data/doc/files/lib/locale_rb.html +363 -0
  48. data/doc/fr_class_index.html +22 -0
  49. data/doc/fr_file_index.html +23 -0
  50. data/doc/fr_method_index.html +99 -0
  51. data/doc/index.html +1 -0
  52. data/doc/rdoc-style.css +320 -0
  53. data/lib/locale/util/memoizable.rb.20090328 +96 -0
  54. data/lib/locale/util/memoizable.rb.old +91 -0
  55. data/lib/locale/version.rb +1 -1
  56. data/replace.rb +21 -0
  57. data/test.rb +28 -0
  58. data/test/test.rb +7 -0
  59. data/test/tmp.txt +20 -0
  60. data/test2.rb +14 -0
  61. data/test3.rb +12 -0
  62. metadata +75 -1
@@ -0,0 +1,433 @@
1
+ <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>Module: Locale::Tag</title><link type="text/css" href="../.././rdoc-style.css" media="screen" rel="stylesheet"/><script type="text/javascript">
2
+ // Allison template
3
+ // Copyright 2007, 2008 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file.
4
+
5
+ var href_base = '../.././rdoc-style.css'.replace(/(.*\/).*/, '$1'); // inline js is good for something
6
+
7
+ function $(id) {
8
+ if (document.getElementById)
9
+ elem = document.getElementById(id);
10
+ else if ( document.all )
11
+ elem = eval("document.all." + id);
12
+ else
13
+ return false;
14
+ return elem;
15
+ }
16
+
17
+ function toggle(id) {
18
+ elem = $(id);
19
+ elemStyle = elem.style;
20
+ if (elemStyle.display == "block") {
21
+ elemStyle.display = "none"
22
+ } else {
23
+ elemStyle.display = "block"
24
+ }
25
+ return true;
26
+ }
27
+
28
+ function toggleText(id) {
29
+ elem = $(id)
30
+ if (m = elem.innerHTML.match(/(Hide)(.*)/)) {
31
+ elem.innerHTML = "Show" + m[2];
32
+ } else if (m = elem.innerHTML.match(/(Show)(.*)/)) {
33
+ elem.innerHTML = "Hide" + m[2];
34
+ }
35
+ return true;
36
+ }
37
+
38
+ function span(s, klass) {
39
+ return '<span class="' + klass + '">' + s + '</span>';
40
+ }
41
+
42
+ function highlightSymbols() {
43
+ pres = document.getElementsByTagName('pre');
44
+ for(var i = 0; i < pres.length; i++) {
45
+ pre = pres[i];
46
+ spans = pre.getElementsByTagName('span');
47
+ for(var k = 0; k < spans.length; k++) {
48
+ span = spans[k];
49
+ if (span.className.match(/ruby-identifier/)) {
50
+ if (span.innerHTML.match(/^:/)) {
51
+ span.className += " ruby-symbol";
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ function hasClass(obj) {
59
+ var result = false;
60
+ if (obj.getAttributeNode("class") != null) {
61
+ result = obj.getAttributeNode("class").value;
62
+ }
63
+ return result;
64
+ }
65
+
66
+ function stripe() {
67
+ var even = true;
68
+ var color = "#e4ebed";
69
+ var tables = document.getElementsByTagName('table');
70
+ if (tables.length == 0) { return; }
71
+ for (var h = 0; h < tables.length; h++) {
72
+ var trs = tables[h].getElementsByTagName("tr");
73
+ for (var i = 0; i < trs.length; i++) {
74
+ var tds = trs[i].getElementsByTagName("td");
75
+ for (var j = 0; j < tds.length; j++) {
76
+ if (hasClass(tds[j]) != "first") {
77
+ var mytd = tds[j];
78
+ if (even) {
79
+ mytd.style.backgroundColor = color;
80
+ }
81
+ }
82
+ }
83
+ even = ! even;
84
+ }
85
+ }
86
+ }
87
+
88
+ function ajaxGet(url) {
89
+ url = (href_base + url).replace('/./', '/')
90
+ var req = false;
91
+
92
+ if (window.ActiveXObject) {
93
+ try {
94
+ // stupid hack because IE7 disables local Ajax with the native xmlhttprequest object
95
+ // for security purposes. Yet ActiveX still works. Thanks, Microsoft. I hate you. Die.
96
+ req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
97
+ } catch (e) {
98
+ try {
99
+ /* IE 6 and maybe 5, don't know, don't care */
100
+ req = new ActiveXObject("Msxml2.XMLHTTP");
101
+ } catch (e) {
102
+ try {
103
+ req = new ActiveXObject("Microsoft.XMLHTTP");
104
+ } catch (e) {
105
+ req = false;
106
+ }
107
+ }
108
+ }
109
+ }
110
+
111
+ /* real browsers */
112
+ if (!req && window.XMLHttpRequest) {
113
+ try {
114
+ req = new XMLHttpRequest();
115
+ } catch (e) {
116
+ req = false;
117
+ }
118
+ }
119
+
120
+ if (req) {
121
+ req.open('GET', url, false);
122
+ req.send(null);
123
+ return req.responseText;
124
+ } else {
125
+ return "Ajax error";
126
+ }
127
+ }
128
+
129
+
130
+ function addEvent(elm, evType, fn, useCapture) {
131
+ if (elm.addEventListener) {
132
+ elm.addEventListener(evType, fn, useCapture);
133
+ return true;
134
+ } else if (elm.attachEvent) {
135
+ var r = elm.attachEvent('on' + evType, fn);
136
+ return r;
137
+ } else {
138
+ elm['on' + evType] = fn;
139
+ }
140
+ }
141
+
142
+ function insertIndices() {
143
+ pages = ["class", "file", "method"]
144
+ for (x in pages) {
145
+ $(pages[x]).innerHTML += ajaxGet('fr_' + pages[x] + '_index.html').replace(/(href=")/g, '$1' + href_base);
146
+ }
147
+ /* mouseoverify method links */
148
+ links = $('method').getElementsByTagName('a');
149
+ for (var x = 0; x < links.length; x++) {
150
+ if (m = links[x].innerHTML.match(/(.*)\s\((.*)\)/)) {
151
+ links[x].innerHTML = m[1] + '<br>';
152
+ links[x].title = m[2];
153
+ }
154
+ }
155
+ /* this is stupid */
156
+ $('class').style.display = "block";
157
+ $('file').style.display = "block";
158
+
159
+ /* has to be here because IE7 does not guarantee the onLoad callback order */
160
+ abbreviateIndicesInner(["class", "file"], 25, "a");
161
+ /* same, linkTitle() depends on the class link list */
162
+ linkTitle();
163
+ }
164
+
165
+ function abbreviateIndices() {
166
+ var ids = ["defined_in", "child_of", "includes", "requires", "method", "methods"];
167
+ abbreviateIndicesInner(ids, 25, 'a');
168
+ abbreviateIndicesInner(ids, 25, 'span');
169
+ }
170
+
171
+ function abbreviateIndicesInner(indices, amount, tag) {
172
+ for (var x = 0; x < indices.length; x++) {
173
+ var the_index = $(indices[x]);
174
+ if (the_index) {
175
+ links = the_index.getElementsByTagName(tag);
176
+ for (var y = 0; y < links.length; y++) {
177
+ var link = links[y];
178
+ if (link.getElementsByTagName('span').length == 0 && link.getElementsByTagName('a').length == 0) {
179
+ // avoid nesting
180
+ link.innerHTML = link.innerHTML.replace(/<br>|\n/gi, '');
181
+ link.title = link.innerHTML;
182
+ link.innerHTML = abbreviate(link.innerHTML, amount) + '<br>';
183
+ }
184
+ }
185
+ }
186
+ }
187
+ }
188
+
189
+ function linkTitle() {
190
+
191
+ /* grab the correct title element from the index */
192
+ var index_page = ajaxGet('index.html');
193
+ title_text = index_page.match(/<title>(.*)<\/title>/m)[1];
194
+ document.title = title_text + " - " + document.title;
195
+ var p = $('header').getElementsByTagName('p')[0]
196
+ if (p.innerHTML.match(/^\s*$/)) {
197
+ p.innerHTML = title_text;
198
+ } else {
199
+ p.innerHTML = title_text + ": " + p.innerHTML;
200
+ }
201
+
202
+ /* set the link properly */
203
+ title_link = index_page.match(/<a\s+href="(.*?)"/)[1];
204
+ var element = $('title');
205
+ var item_type = "";
206
+ var item_name = "";
207
+ if (m = element.innerHTML.match(/(Class:|Module:|File:)\s*(.*)/)) {
208
+ item_type = m[1];
209
+ item_name = m[2];
210
+ } else {
211
+ item_name = element.innerHTML;
212
+ }
213
+ element.innerHTML = '<a href="' + href_base + title_link + '">' + item_type + " " + abbreviate(item_name, 45) + '</a>';
214
+ element.getElementsByTagName('a')[0].title = item_name
215
+
216
+ /* breadcrumb navigation */
217
+ items = item_name.split("::");
218
+ items_new = item_name.split("::");
219
+ file_links = $('class').getElementsByTagName('a');
220
+ for (var x = 0; x < items.length - 1; x++ ){
221
+ var item = items[x];
222
+ link = ("/classes/" + items.slice(0,x).join("/") + "/" + item + ".html").replace('//', '/');
223
+ regex = new RegExp(RegExp.escape(link) + '$');
224
+ for (var y = 0; y < file_links.length; y++) {
225
+ if (file_links[y].href.match(regex)) {
226
+ items_new[x] = '<a href="' + href_base + link + '">' + item + '</a>';
227
+ break;
228
+ }
229
+ }
230
+ }
231
+ $('item_name').innerHTML = item_type + ' ' + items_new.join(" :: ");
232
+ }
233
+
234
+ function abbreviate(s, size) {
235
+ while (s.length > size) {
236
+ var old_s = s;
237
+ s = s.replace(/\s|\n/mg, '');
238
+ s = s.replace(/([A-Z])[a-z]+/m, '$1');
239
+ if (!s || old_s == s) {
240
+ return "..." + s.substring(s.length - size, s.length);
241
+ }
242
+ }
243
+ return s;
244
+ }
245
+
246
+ function disableSubmit(event) {
247
+ var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
248
+ if (keyCode == 13) {
249
+ return false;
250
+ } else {
251
+ return true;
252
+ }
253
+ }
254
+
255
+ function filterList(id, s, event) {
256
+
257
+ /* some weak escaping */
258
+ s = s.replace(/[^\w\d\.\_\-\/\:\=\[\]\?\!]/g, '');
259
+ s = RegExp.escape(s);
260
+
261
+ var show_all = false;
262
+ if (s.match(/^\s*$/)) {
263
+ show_all = true;
264
+ }
265
+
266
+ links = $(id).getElementsByTagName('a')
267
+ regex = new RegExp(s, 'i');
268
+
269
+ for (var x = 0; x < links.length; x++) {
270
+ var link = links[x];
271
+ if (show_all) {
272
+ link.style.display = 'inline';
273
+ } else {
274
+ if (link.innerHTML.match(regex)) {
275
+ link.style.display = 'inline';
276
+ } else {
277
+ link.style.display = 'none';
278
+ }
279
+ }
280
+ }
281
+ return true;
282
+ }
283
+
284
+ RegExp.escape = function(text) {
285
+ if (!arguments.callee.sRE) {
286
+ var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
287
+ arguments.callee.sRE = new RegExp(
288
+ '(\\' + specials.join('|\\') + ')', 'g'
289
+ );
290
+ }
291
+ return text.replace(arguments.callee.sRE, '\\$1');
292
+ }
293
+
294
+ function hacks() {
295
+ // show the spacer if necessary,
296
+ divs = document.getElementsByTagName('div');
297
+ for(var x = 0; x < divs.length; x++) {
298
+ if (divs[x].className && divs[x].className.match(/top/)) {
299
+ document.getElementById('spacer').style.display = 'block';
300
+ }
301
+ }
302
+ // remove extra colons from tables
303
+ tds = document.getElementsByTagName('td');
304
+ for(var x = 0; x < tds.length; x++) {
305
+ str = tds[x].innerHTML
306
+ if (str.charAt(str.length - 1) == ":") {
307
+ tds[x].innerHTML = str.slice(0, str.length - 1)
308
+ }
309
+ }
310
+ }
311
+
312
+ addEvent(window, 'load', insertIndices, false);
313
+ addEvent(window, 'load', abbreviateIndices, false);
314
+ addEvent(window, 'load', stripe, false);
315
+ addEvent(window, 'load', highlightSymbols, false);
316
+ addEvent(window, 'load', hacks, false);
317
+ </script></head><body><div id="container"><div class="curve" id="preheader_curve_0"></div><div class="curve" id="preheader_curve_1"></div><div class="curve" id="preheader_curve_2"></div><div class="curve" id="preheader_curve_3"></div><div class="curve" id="preheader_curve_4"></div><div class="curve" id="preheader_curve_5"></div><div id="header"><p>
318
+ </p><span><h1 id="title">
319
+ Module: Locale::Tag
320
+ </h1></span></div><div class="clear"></div><div id="left">
321
+
322
+ <div class="navigation darker top" id="defined_in"><h3>Defined in</h3>
323
+
324
+ <a href="../../files/lib/locale/tag_rb.html">lib/locale/tag.rb</a>
325
+
326
+
327
+ <a href="../../files/lib/locale/tag/cldr_rb.html">lib/locale/tag/cldr.rb</a>
328
+
329
+
330
+ <a href="../../files/lib/locale/tag/common_rb.html">lib/locale/tag/common.rb</a>
331
+
332
+
333
+ <a href="../../files/lib/locale/tag/rfc_rb.html">lib/locale/tag/rfc.rb</a>
334
+
335
+
336
+ <a href="../../files/lib/locale/tag/irregular_rb.html">lib/locale/tag/irregular.rb</a>
337
+
338
+
339
+ <a href="../../files/lib/locale/tag/posix_rb.html">lib/locale/tag/posix.rb</a>
340
+
341
+
342
+ <a href="../../files/lib/locale/tag/simple_rb.html">lib/locale/tag/simple.rb</a>
343
+
344
+ </div>
345
+
346
+ <div class="navigation top" id="includes"><h3>Includes</h3>
347
+
348
+
349
+ <a href='Util/Memoizable.html'>
350
+ Util::Memoizable<br/>
351
+ </a>
352
+
353
+
354
+ </div>
355
+
356
+
357
+ <div class="navigation top" id="methods"><h3>Methods</h3>
358
+
359
+
360
+ <a href='#M000022'>
361
+ parse<br/>
362
+ </a>
363
+
364
+
365
+ </div>
366
+ <div id="spacer"></div><div class="navigation darker index" id="class_wrapper"><div class="list_header"><h3>All classes</h3></div><div class="list_header_link"><a href="#" onclick="toggle('class'); toggleText('class_link'); return false;" id="class_link">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter:&nbsp;&nbsp;</label><input type="text" onKeyUp="return filterList('class', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_class"></input></form></div></div><div class="navigation darker index" id="file_wrapper"><div class="list_header"><h3>All files</h3></div><div class="list_header_link"><a href="#" onclick="toggle('file'); toggleText('file_link'); return false;" id="file_link">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter:&nbsp;&nbsp;</label><input type="text" onKeyUp="return filterList('file', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_file"></input></form></div></div><div class="navigation darker index" id="method_wrapper"><div class="list_header"><h3>All methods</h3></div><div class="list_header_link"><a href="#" onclick="toggle('method'); toggleText('method_link'); return false;" id="method_link">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter:&nbsp;&nbsp;</label><input type="text" onKeyUp="return filterList('method', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_method"></input></form></div></div></div><div id="content">
367
+ <h1 id="item_name">Module: Locale::Tag</h1>
368
+
369
+ <div id="description"><p>
370
+ Language tag / locale identifiers.
371
+ </p>
372
+ </div>
373
+
374
+
375
+
376
+
377
+ <p></p>
378
+
379
+ <h1>Child modules and classes</h1><p>Class <a href="Tag/Cldr.html" class="link">Locale::Tag::Cldr</a><br />
380
+ Class <a href="Tag/Common.html" class="link">Locale::Tag::Common</a><br />
381
+ Class <a href="Tag/Irregular.html" class="link">Locale::Tag::Irregular</a><br />
382
+ Class <a href="Tag/Posix.html" class="link">Locale::Tag::Posix</a><br />
383
+ Class <a href="Tag/Rfc.html" class="link">Locale::Tag::Rfc</a><br />
384
+ Class <a href="Tag/Simple.html" class="link">Locale::Tag::Simple</a><br />
385
+ </p>
386
+
387
+
388
+
389
+
390
+
391
+ <h1>Public Instance Methods</h1>
392
+
393
+
394
+ <a class="small" name="M000022"><br/></a>
395
+ <div class="method_block"><h3>
396
+ <a href='#M000022'>
397
+
398
+
399
+ parse
400
+
401
+ (tag)
402
+
403
+ </a>
404
+ </h3>
405
+ <p>
406
+ Parse a language tag/locale name and return <a
407
+ href="Tag.html">Locale::Tag</a> object.
408
+ </p>
409
+ <ul>
410
+ <li>tag: a tag as a String. e.g.) ja-Hira-JP
411
+
412
+ </li>
413
+ <li>Returns: a <a href="Tag.html">Locale::Tag</a> subclass.
414
+
415
+ </li>
416
+ </ul>
417
+
418
+ <p class="source_link" id="M000022-show-link"><a href="#" onclick="toggle('M000022-source'); toggleText('M000022-link'); return false;" id="M000022-link">Show source...</a></p><div class="source" id="M000022-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag.rb, line 28</span>
419
+ 28: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">tag</span>)
420
+ 29: <span class="ruby-comment cmt"># Common is not used here.</span>
421
+ 30: [<span class="ruby-constant">Simple</span>, <span class="ruby-constant">Common</span>, <span class="ruby-constant">Rfc</span>, <span class="ruby-constant">Cldr</span>, <span class="ruby-constant">Posix</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">parser</span><span class="ruby-operator">|</span>
422
+ 31: <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">tag</span>)
423
+ 32: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ret</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ret</span>
424
+ 33: <span class="ruby-keyword kw">end</span>
425
+ 34: <span class="ruby-constant">Locale</span><span class="ruby-operator">::</span><span class="ruby-constant">Tag</span><span class="ruby-operator">::</span><span class="ruby-constant">Irregular</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">tag</span>)
426
+ 35: <span class="ruby-keyword kw">end</span></pre></div>
427
+ </div>
428
+
429
+
430
+
431
+
432
+
433
+ </div><div class="clear" id="footer">Generated on May 9, 2009 / Allison 2 &copy; 2007 <a href="http://cloudbur.st">Cloudburst, LLC</a></div></div></body></html>
@@ -0,0 +1,523 @@
1
+ <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>Class: Locale::Tag::Cldr</title><link type="text/css" href="../../.././rdoc-style.css" media="screen" rel="stylesheet"/><script type="text/javascript">
2
+ // Allison template
3
+ // Copyright 2007, 2008 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file.
4
+
5
+ var href_base = '../../.././rdoc-style.css'.replace(/(.*\/).*/, '$1'); // inline js is good for something
6
+
7
+ function $(id) {
8
+ if (document.getElementById)
9
+ elem = document.getElementById(id);
10
+ else if ( document.all )
11
+ elem = eval("document.all." + id);
12
+ else
13
+ return false;
14
+ return elem;
15
+ }
16
+
17
+ function toggle(id) {
18
+ elem = $(id);
19
+ elemStyle = elem.style;
20
+ if (elemStyle.display == "block") {
21
+ elemStyle.display = "none"
22
+ } else {
23
+ elemStyle.display = "block"
24
+ }
25
+ return true;
26
+ }
27
+
28
+ function toggleText(id) {
29
+ elem = $(id)
30
+ if (m = elem.innerHTML.match(/(Hide)(.*)/)) {
31
+ elem.innerHTML = "Show" + m[2];
32
+ } else if (m = elem.innerHTML.match(/(Show)(.*)/)) {
33
+ elem.innerHTML = "Hide" + m[2];
34
+ }
35
+ return true;
36
+ }
37
+
38
+ function span(s, klass) {
39
+ return '<span class="' + klass + '">' + s + '</span>';
40
+ }
41
+
42
+ function highlightSymbols() {
43
+ pres = document.getElementsByTagName('pre');
44
+ for(var i = 0; i < pres.length; i++) {
45
+ pre = pres[i];
46
+ spans = pre.getElementsByTagName('span');
47
+ for(var k = 0; k < spans.length; k++) {
48
+ span = spans[k];
49
+ if (span.className.match(/ruby-identifier/)) {
50
+ if (span.innerHTML.match(/^:/)) {
51
+ span.className += " ruby-symbol";
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ function hasClass(obj) {
59
+ var result = false;
60
+ if (obj.getAttributeNode("class") != null) {
61
+ result = obj.getAttributeNode("class").value;
62
+ }
63
+ return result;
64
+ }
65
+
66
+ function stripe() {
67
+ var even = true;
68
+ var color = "#e4ebed";
69
+ var tables = document.getElementsByTagName('table');
70
+ if (tables.length == 0) { return; }
71
+ for (var h = 0; h < tables.length; h++) {
72
+ var trs = tables[h].getElementsByTagName("tr");
73
+ for (var i = 0; i < trs.length; i++) {
74
+ var tds = trs[i].getElementsByTagName("td");
75
+ for (var j = 0; j < tds.length; j++) {
76
+ if (hasClass(tds[j]) != "first") {
77
+ var mytd = tds[j];
78
+ if (even) {
79
+ mytd.style.backgroundColor = color;
80
+ }
81
+ }
82
+ }
83
+ even = ! even;
84
+ }
85
+ }
86
+ }
87
+
88
+ function ajaxGet(url) {
89
+ url = (href_base + url).replace('/./', '/')
90
+ var req = false;
91
+
92
+ if (window.ActiveXObject) {
93
+ try {
94
+ // stupid hack because IE7 disables local Ajax with the native xmlhttprequest object
95
+ // for security purposes. Yet ActiveX still works. Thanks, Microsoft. I hate you. Die.
96
+ req = new ActiveXObject("MSXML2.XMLHTTP.3.0");
97
+ } catch (e) {
98
+ try {
99
+ /* IE 6 and maybe 5, don't know, don't care */
100
+ req = new ActiveXObject("Msxml2.XMLHTTP");
101
+ } catch (e) {
102
+ try {
103
+ req = new ActiveXObject("Microsoft.XMLHTTP");
104
+ } catch (e) {
105
+ req = false;
106
+ }
107
+ }
108
+ }
109
+ }
110
+
111
+ /* real browsers */
112
+ if (!req && window.XMLHttpRequest) {
113
+ try {
114
+ req = new XMLHttpRequest();
115
+ } catch (e) {
116
+ req = false;
117
+ }
118
+ }
119
+
120
+ if (req) {
121
+ req.open('GET', url, false);
122
+ req.send(null);
123
+ return req.responseText;
124
+ } else {
125
+ return "Ajax error";
126
+ }
127
+ }
128
+
129
+
130
+ function addEvent(elm, evType, fn, useCapture) {
131
+ if (elm.addEventListener) {
132
+ elm.addEventListener(evType, fn, useCapture);
133
+ return true;
134
+ } else if (elm.attachEvent) {
135
+ var r = elm.attachEvent('on' + evType, fn);
136
+ return r;
137
+ } else {
138
+ elm['on' + evType] = fn;
139
+ }
140
+ }
141
+
142
+ function insertIndices() {
143
+ pages = ["class", "file", "method"]
144
+ for (x in pages) {
145
+ $(pages[x]).innerHTML += ajaxGet('fr_' + pages[x] + '_index.html').replace(/(href=")/g, '$1' + href_base);
146
+ }
147
+ /* mouseoverify method links */
148
+ links = $('method').getElementsByTagName('a');
149
+ for (var x = 0; x < links.length; x++) {
150
+ if (m = links[x].innerHTML.match(/(.*)\s\((.*)\)/)) {
151
+ links[x].innerHTML = m[1] + '<br>';
152
+ links[x].title = m[2];
153
+ }
154
+ }
155
+ /* this is stupid */
156
+ $('class').style.display = "block";
157
+ $('file').style.display = "block";
158
+
159
+ /* has to be here because IE7 does not guarantee the onLoad callback order */
160
+ abbreviateIndicesInner(["class", "file"], 25, "a");
161
+ /* same, linkTitle() depends on the class link list */
162
+ linkTitle();
163
+ }
164
+
165
+ function abbreviateIndices() {
166
+ var ids = ["defined_in", "child_of", "includes", "requires", "method", "methods"];
167
+ abbreviateIndicesInner(ids, 25, 'a');
168
+ abbreviateIndicesInner(ids, 25, 'span');
169
+ }
170
+
171
+ function abbreviateIndicesInner(indices, amount, tag) {
172
+ for (var x = 0; x < indices.length; x++) {
173
+ var the_index = $(indices[x]);
174
+ if (the_index) {
175
+ links = the_index.getElementsByTagName(tag);
176
+ for (var y = 0; y < links.length; y++) {
177
+ var link = links[y];
178
+ if (link.getElementsByTagName('span').length == 0 && link.getElementsByTagName('a').length == 0) {
179
+ // avoid nesting
180
+ link.innerHTML = link.innerHTML.replace(/<br>|\n/gi, '');
181
+ link.title = link.innerHTML;
182
+ link.innerHTML = abbreviate(link.innerHTML, amount) + '<br>';
183
+ }
184
+ }
185
+ }
186
+ }
187
+ }
188
+
189
+ function linkTitle() {
190
+
191
+ /* grab the correct title element from the index */
192
+ var index_page = ajaxGet('index.html');
193
+ title_text = index_page.match(/<title>(.*)<\/title>/m)[1];
194
+ document.title = title_text + " - " + document.title;
195
+ var p = $('header').getElementsByTagName('p')[0]
196
+ if (p.innerHTML.match(/^\s*$/)) {
197
+ p.innerHTML = title_text;
198
+ } else {
199
+ p.innerHTML = title_text + ": " + p.innerHTML;
200
+ }
201
+
202
+ /* set the link properly */
203
+ title_link = index_page.match(/<a\s+href="(.*?)"/)[1];
204
+ var element = $('title');
205
+ var item_type = "";
206
+ var item_name = "";
207
+ if (m = element.innerHTML.match(/(Class:|Module:|File:)\s*(.*)/)) {
208
+ item_type = m[1];
209
+ item_name = m[2];
210
+ } else {
211
+ item_name = element.innerHTML;
212
+ }
213
+ element.innerHTML = '<a href="' + href_base + title_link + '">' + item_type + " " + abbreviate(item_name, 45) + '</a>';
214
+ element.getElementsByTagName('a')[0].title = item_name
215
+
216
+ /* breadcrumb navigation */
217
+ items = item_name.split("::");
218
+ items_new = item_name.split("::");
219
+ file_links = $('class').getElementsByTagName('a');
220
+ for (var x = 0; x < items.length - 1; x++ ){
221
+ var item = items[x];
222
+ link = ("/classes/" + items.slice(0,x).join("/") + "/" + item + ".html").replace('//', '/');
223
+ regex = new RegExp(RegExp.escape(link) + '$');
224
+ for (var y = 0; y < file_links.length; y++) {
225
+ if (file_links[y].href.match(regex)) {
226
+ items_new[x] = '<a href="' + href_base + link + '">' + item + '</a>';
227
+ break;
228
+ }
229
+ }
230
+ }
231
+ $('item_name').innerHTML = item_type + ' ' + items_new.join(" :: ");
232
+ }
233
+
234
+ function abbreviate(s, size) {
235
+ while (s.length > size) {
236
+ var old_s = s;
237
+ s = s.replace(/\s|\n/mg, '');
238
+ s = s.replace(/([A-Z])[a-z]+/m, '$1');
239
+ if (!s || old_s == s) {
240
+ return "..." + s.substring(s.length - size, s.length);
241
+ }
242
+ }
243
+ return s;
244
+ }
245
+
246
+ function disableSubmit(event) {
247
+ var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
248
+ if (keyCode == 13) {
249
+ return false;
250
+ } else {
251
+ return true;
252
+ }
253
+ }
254
+
255
+ function filterList(id, s, event) {
256
+
257
+ /* some weak escaping */
258
+ s = s.replace(/[^\w\d\.\_\-\/\:\=\[\]\?\!]/g, '');
259
+ s = RegExp.escape(s);
260
+
261
+ var show_all = false;
262
+ if (s.match(/^\s*$/)) {
263
+ show_all = true;
264
+ }
265
+
266
+ links = $(id).getElementsByTagName('a')
267
+ regex = new RegExp(s, 'i');
268
+
269
+ for (var x = 0; x < links.length; x++) {
270
+ var link = links[x];
271
+ if (show_all) {
272
+ link.style.display = 'inline';
273
+ } else {
274
+ if (link.innerHTML.match(regex)) {
275
+ link.style.display = 'inline';
276
+ } else {
277
+ link.style.display = 'none';
278
+ }
279
+ }
280
+ }
281
+ return true;
282
+ }
283
+
284
+ RegExp.escape = function(text) {
285
+ if (!arguments.callee.sRE) {
286
+ var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
287
+ arguments.callee.sRE = new RegExp(
288
+ '(\\' + specials.join('|\\') + ')', 'g'
289
+ );
290
+ }
291
+ return text.replace(arguments.callee.sRE, '\\$1');
292
+ }
293
+
294
+ function hacks() {
295
+ // show the spacer if necessary,
296
+ divs = document.getElementsByTagName('div');
297
+ for(var x = 0; x < divs.length; x++) {
298
+ if (divs[x].className && divs[x].className.match(/top/)) {
299
+ document.getElementById('spacer').style.display = 'block';
300
+ }
301
+ }
302
+ // remove extra colons from tables
303
+ tds = document.getElementsByTagName('td');
304
+ for(var x = 0; x < tds.length; x++) {
305
+ str = tds[x].innerHTML
306
+ if (str.charAt(str.length - 1) == ":") {
307
+ tds[x].innerHTML = str.slice(0, str.length - 1)
308
+ }
309
+ }
310
+ }
311
+
312
+ addEvent(window, 'load', insertIndices, false);
313
+ addEvent(window, 'load', abbreviateIndices, false);
314
+ addEvent(window, 'load', stripe, false);
315
+ addEvent(window, 'load', highlightSymbols, false);
316
+ addEvent(window, 'load', hacks, false);
317
+ </script></head><body><div id="container"><div class="curve" id="preheader_curve_0"></div><div class="curve" id="preheader_curve_1"></div><div class="curve" id="preheader_curve_2"></div><div class="curve" id="preheader_curve_3"></div><div class="curve" id="preheader_curve_4"></div><div class="curve" id="preheader_curve_5"></div><div id="header"><p>
318
+ </p><span><h1 id="title">
319
+ Class: Locale::Tag::Cldr
320
+ </h1></span></div><div class="clear"></div><div id="left">
321
+ <div class="navigation darker top" id="child_of"><h3>Child of</h3><span>
322
+
323
+ <a href='Common.html'>
324
+ Common
325
+ </a>
326
+ </span></div>
327
+
328
+ <div class="navigation darker top" id="defined_in"><h3>Defined in</h3>
329
+
330
+ <a href="../../../files/lib/locale/tag/cldr_rb.html">lib/locale/tag/cldr.rb</a>
331
+
332
+ </div>
333
+
334
+ <div class="navigation top" id="includes"><h3>Includes</h3>
335
+
336
+
337
+ <a href='../Util/Memoizable.html'>
338
+ Util::Memoizable<br/>
339
+ </a>
340
+
341
+
342
+ </div>
343
+
344
+
345
+ <div class="navigation top" id="methods"><h3>Methods</h3>
346
+
347
+
348
+ <a href='#M000030'>
349
+ extensions=<br/>
350
+ </a>
351
+
352
+
353
+
354
+
355
+ <a href='#M000029'>
356
+ new<br/>
357
+ </a>
358
+
359
+
360
+
361
+
362
+ <a href='#M000028'>
363
+ parse<br/>
364
+ </a>
365
+
366
+
367
+ </div>
368
+ <div id="spacer"></div><div class="navigation darker index" id="class_wrapper"><div class="list_header"><h3>All classes</h3></div><div class="list_header_link"><a href="#" onclick="toggle('class'); toggleText('class_link'); return false;" id="class_link">Hide...</a></div><div class="clear"></div><div id="class"><form><label for="filter_class">Filter:&nbsp;&nbsp;</label><input type="text" onKeyUp="return filterList('class', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_class"></input></form></div></div><div class="navigation darker index" id="file_wrapper"><div class="list_header"><h3>All files</h3></div><div class="list_header_link"><a href="#" onclick="toggle('file'); toggleText('file_link'); return false;" id="file_link">Hide...</a></div><div class="clear"></div><div id="file"><form><label for="filter_file">Filter:&nbsp;&nbsp;</label><input type="text" onKeyUp="return filterList('file', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_file"></input></form></div></div><div class="navigation darker index" id="method_wrapper"><div class="list_header"><h3>All methods</h3></div><div class="list_header_link"><a href="#" onclick="toggle('method'); toggleText('method_link'); return false;" id="method_link">Show...</a></div><div class="clear"></div><div id="method"><form><label for="filter_method">Filter:&nbsp;&nbsp;</label><input type="text" onKeyUp="return filterList('method', this.value, event);" onKeyPress="return disableSubmit(event);" id="filter_method"></input></form></div></div></div><div id="content">
369
+ <h1 id="item_name">Class: Locale::Tag::Cldr</h1>
370
+
371
+ <div id="description"><p>
372
+ Unicode locale identifier class for CLDR-1.6.1. (Unicode <a
373
+ href="Common.html">Common</a> <a href="../../Locale.html">Locale</a> Data
374
+ Repository).
375
+ </p>
376
+ </div>
377
+
378
+
379
+
380
+
381
+ <p></p>
382
+
383
+
384
+ <h1>Constants</h1><p><table><tr><th>Name</th><th>Value</th></tr>
385
+ <tr>
386
+ <td class="highlight">VARIANT</td>
387
+
388
+ <td class="normal">&quot;(#{ALPHANUM}{5,8}|#{DIGIT}#{ALPHANUM}{3})&quot;</td>
389
+
390
+
391
+
392
+ </tr>
393
+ <tr>
394
+ <td class="highlight">EXTENSION</td>
395
+
396
+ <td class="normal">&quot;#{ALPHANUM}+=[a-z0-9\-]+&quot;</td>
397
+
398
+
399
+
400
+ </tr>
401
+ <tr>
402
+ <td class="highlight">TAG_RE</td>
403
+
404
+ <td class="normal">/\A#{LANGUAGE}(?:[-_]#{SCRIPT})? (?:[-_]#{REGION})?((?:[-_]#{VARIANT})* (?:@(#{EXTENSION};?)+)*)\Z/ix</td>
405
+
406
+
407
+
408
+ </tr>
409
+ </table></p>
410
+
411
+
412
+ <h1>Attributes</h1><p><table><tr><th>Name</th><th>Read/write?</th></tr>
413
+ <tr>
414
+ <td class="highlight">extensions</td>
415
+
416
+
417
+
418
+
419
+ <td class="normal">R</td>
420
+ </tr>
421
+ </table></p>
422
+
423
+
424
+ <h1>Public Class Methods</h1>
425
+
426
+
427
+ <a class="small" name="M000029"><br/></a>
428
+ <div class="method_block"><h3>
429
+ <a href='#M000029'>
430
+
431
+
432
+ new
433
+
434
+ (language, script = nil, region = nil, variants = [], extensions = {})
435
+
436
+ </a>
437
+ </h3>
438
+ <p>
439
+ Create <a href="Cldr.html">Locale::Tag::Cldr</a>.
440
+ </p>
441
+ <p>
442
+ variants should be upcase.
443
+ </p>
444
+
445
+ <p class="source_link" id="M000029-show-link"><a href="#" onclick="toggle('M000029-source'); toggleText('M000029-link'); return false;" id="M000029-link">Show source...</a></p><div class="source" id="M000029-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/cldr.rb, line 58</span>
446
+ 58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">language</span>, <span class="ruby-identifier">script</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">region</span> = <span class="ruby-keyword kw">nil</span>,
447
+ 59: <span class="ruby-identifier">variants</span> = [], <span class="ruby-identifier">extensions</span> = {})
448
+ 60: <span class="ruby-ivar">@extensions</span> = <span class="ruby-identifier">extensions</span>
449
+ 61: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">language</span>, <span class="ruby-identifier">script</span>, <span class="ruby-identifier">region</span>, <span class="ruby-identifier">variants</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">upcase</span>})
450
+ 62: <span class="ruby-keyword kw">end</span></pre></div>
451
+ </div>
452
+
453
+ <a class="small" name="M000028"><br/></a>
454
+ <div class="method_block"><h3>
455
+ <a href='#M000028'>
456
+
457
+
458
+ parse
459
+
460
+ (tag)
461
+
462
+ </a>
463
+ </h3>
464
+ <p>
465
+ Parse the language tag and return the <a href="Cldr.html#M000029">new</a>
466
+ Locale::Tag::CLDR.
467
+ </p>
468
+
469
+ <p class="source_link" id="M000028-show-link"><a href="#" onclick="toggle('M000028-source'); toggleText('M000028-link'); return false;" id="M000028-link">Show source...</a></p><div class="source" id="M000028-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/cldr.rb, line 31</span>
470
+ 31: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">tag</span>)
471
+ 32: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tag</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\APOSIX\Z/</span> <span class="ruby-comment cmt"># This is the special case of POSIX locale but match this regexp.</span>
472
+ 33: <span class="ruby-keyword kw">nil</span>
473
+ 34: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">tag</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">TAG_RE</span>
474
+ 35: <span class="ruby-identifier">lang</span>, <span class="ruby-identifier">script</span>, <span class="ruby-identifier">region</span>, <span class="ruby-identifier">subtag</span> = <span class="ruby-identifier">$1</span>, <span class="ruby-identifier">$2</span>, <span class="ruby-identifier">$3</span>, <span class="ruby-identifier">$4</span>
475
+ 36:
476
+ 37: <span class="ruby-identifier">extensions</span> = {}
477
+ 38: <span class="ruby-identifier">subtag</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-node">/#{EXTENSION}/i</span>).<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
478
+ 39: <span class="ruby-identifier">subtag</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-identifier">v</span>, <span class="ruby-value str">&quot;&quot;</span>)
479
+ 40: <span class="ruby-identifier">key</span>, <span class="ruby-identifier">type</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;=&quot;</span>)
480
+ 41: <span class="ruby-identifier">extensions</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">type</span>
481
+ 42: }
482
+ 43: <span class="ruby-identifier">variants</span> = <span class="ruby-identifier">subtag</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-node">/#{VARIANT}/i</span>).<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">upcase</span>}
483
+ 44:
484
+ 45: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lang</span>, <span class="ruby-identifier">script</span>, <span class="ruby-identifier">region</span>, <span class="ruby-identifier">variants</span>, <span class="ruby-identifier">extensions</span>)
485
+ 46: <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">tag</span> = <span class="ruby-identifier">tag</span>
486
+ 47: <span class="ruby-identifier">ret</span>
487
+ 48: <span class="ruby-keyword kw">else</span>
488
+ 49: <span class="ruby-keyword kw">nil</span>
489
+ 50: <span class="ruby-keyword kw">end</span>
490
+ 51: <span class="ruby-keyword kw">end</span></pre></div>
491
+ </div>
492
+
493
+
494
+ <h1>Public Instance Methods</h1>
495
+
496
+
497
+ <a class="small" name="M000030"><br/></a>
498
+ <div class="method_block"><h3>
499
+ <a href='#M000030'>
500
+
501
+
502
+ extensions=
503
+
504
+ (val)
505
+
506
+ </a>
507
+ </h3>
508
+ <p>
509
+ Sets the extensions as an Hash.
510
+ </p>
511
+
512
+ <p class="source_link" id="M000030-show-link"><a href="#" onclick="toggle('M000030-source'); toggleText('M000030-link'); return false;" id="M000030-link">Show source...</a></p><div class="source" id="M000030-source"><pre> <span class="ruby-comment cmt"># File lib/locale/tag/cldr.rb, line 65</span>
513
+ 65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extensions=</span>(<span class="ruby-identifier">val</span>)
514
+ 66: <span class="ruby-identifier">clear</span>
515
+ 67: <span class="ruby-ivar">@extensions</span> = <span class="ruby-identifier">val</span>
516
+ 68: <span class="ruby-keyword kw">end</span></pre></div>
517
+ </div>
518
+
519
+
520
+
521
+
522
+
523
+ </div><div class="clear" id="footer">Generated on May 9, 2009 / Allison 2 &copy; 2007 <a href="http://cloudbur.st">Cloudburst, LLC</a></div></div></body></html>