formattedstring 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/README +5 -0
  2. data/Rakefile +1 -1
  3. data/doc/classes/Enumerable.html +146 -0
  4. data/doc/classes/Enumerable.src/M000029.html +21 -0
  5. data/doc/classes/Enumerable.src/M000030.html +34 -0
  6. data/doc/classes/FormattedString.html +119 -0
  7. data/doc/classes/FormattedString/Formats.html +121 -0
  8. data/doc/classes/FormattedString/Formats/Json.html +159 -0
  9. data/doc/classes/FormattedString/Formats/Json.src/M000006.html +18 -0
  10. data/doc/classes/FormattedString/Formats/Json.src/M000007.html +18 -0
  11. data/doc/classes/FormattedString/Formats/Xml.html +159 -0
  12. data/doc/classes/FormattedString/Formats/Xml.src/M000004.html +18 -0
  13. data/doc/classes/FormattedString/Formats/Xml.src/M000005.html +52 -0
  14. data/doc/classes/FormattedString/Formats/Yaml.html +131 -0
  15. data/doc/classes/FormattedString/Formats/Yaml.src/M000008.html +18 -0
  16. data/doc/classes/Inflector.html +516 -0
  17. data/doc/classes/Inflector.src/M000009.html +22 -0
  18. data/doc/classes/Inflector.src/M000010.html +25 -0
  19. data/doc/classes/Inflector.src/M000011.html +25 -0
  20. data/doc/classes/Inflector.src/M000012.html +22 -0
  21. data/doc/classes/Inflector.src/M000013.html +18 -0
  22. data/doc/classes/Inflector.src/M000014.html +22 -0
  23. data/doc/classes/Inflector.src/M000015.html +18 -0
  24. data/doc/classes/Inflector.src/M000016.html +18 -0
  25. data/doc/classes/Inflector.src/M000017.html +18 -0
  26. data/doc/classes/Inflector.src/M000018.html +18 -0
  27. data/doc/classes/Inflector.src/M000019.html +19 -0
  28. data/doc/classes/Inflector.src/M000020.html +18 -0
  29. data/doc/classes/Inflector.src/M000021.html +22 -0
  30. data/doc/classes/Inflector.src/M000022.html +27 -0
  31. data/doc/classes/Inflector/Inflections.html +321 -0
  32. data/doc/classes/Inflector/Inflections.src/M000023.html +18 -0
  33. data/doc/classes/Inflector/Inflections.src/M000024.html +18 -0
  34. data/doc/classes/Inflector/Inflections.src/M000025.html +18 -0
  35. data/doc/classes/Inflector/Inflections.src/M000026.html +26 -0
  36. data/doc/classes/Inflector/Inflections.src/M000027.html +18 -0
  37. data/doc/classes/Inflector/Inflections.src/M000028.html +23 -0
  38. data/doc/classes/String.html +191 -0
  39. data/doc/classes/String.src/M000001.html +18 -0
  40. data/doc/classes/String.src/M000002.html +20 -0
  41. data/doc/classes/String.src/M000003.html +19 -0
  42. data/doc/created.rid +1 -0
  43. data/doc/files/LICENSE.html +129 -0
  44. data/doc/files/README.html +201 -0
  45. data/doc/files/lib/formatted_string/formats/json_rb.html +108 -0
  46. data/doc/files/lib/formatted_string/formats/xml_rb.html +119 -0
  47. data/doc/files/lib/formatted_string/formats/yaml_rb.html +101 -0
  48. data/doc/files/lib/formatted_string_rb.html +108 -0
  49. data/doc/files/lib/inflections_rb.html +101 -0
  50. data/doc/files/lib/inflector_rb.html +108 -0
  51. data/doc/fr_class_index.html +35 -0
  52. data/doc/fr_file_index.html +34 -0
  53. data/doc/fr_method_index.html +56 -0
  54. data/doc/index.html +24 -0
  55. data/doc/rdoc-style.css +208 -0
  56. data/lib/formatted_string/formats/json.rb +20 -0
  57. data/lib/formatted_string/formats/xml.rb +8 -5
  58. data/lib/formatted_string/formats/yaml.rb +9 -0
  59. metadata +72 -2
@@ -0,0 +1,22 @@
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>inflections (Inflector)</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 89</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inflections</span>
15
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
16
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-constant">Inflections</span>.<span class="ruby-identifier">instance</span>
17
+ <span class="ruby-keyword kw">else</span>
18
+ <span class="ruby-constant">Inflections</span>.<span class="ruby-identifier">instance</span>
19
+ <span class="ruby-keyword kw">end</span>
20
+ <span class="ruby-keyword kw">end</span></pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,25 @@
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>pluralize (Inflector)</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 106</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pluralize</span>(<span class="ruby-identifier">word</span>)
15
+ <span class="ruby-identifier">result</span> = <span class="ruby-identifier">word</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">dup</span>
16
+
17
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">word</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">inflections</span>.<span class="ruby-identifier">uncountables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">downcase</span>)
18
+ <span class="ruby-identifier">result</span>
19
+ <span class="ruby-keyword kw">else</span>
20
+ <span class="ruby-identifier">inflections</span>.<span class="ruby-identifier">plurals</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)<span class="ruby-operator">|</span> <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>) }
21
+ <span class="ruby-identifier">result</span>
22
+ <span class="ruby-keyword kw">end</span>
23
+ <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>
@@ -0,0 +1,25 @@
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>singularize (Inflector)</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 126</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singularize</span>(<span class="ruby-identifier">word</span>)
15
+ <span class="ruby-identifier">result</span> = <span class="ruby-identifier">word</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">dup</span>
16
+
17
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">inflections</span>.<span class="ruby-identifier">uncountables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">downcase</span>)
18
+ <span class="ruby-identifier">result</span>
19
+ <span class="ruby-keyword kw">else</span>
20
+ <span class="ruby-identifier">inflections</span>.<span class="ruby-identifier">singulars</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)<span class="ruby-operator">|</span> <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>) }
21
+ <span class="ruby-identifier">result</span>
22
+ <span class="ruby-keyword kw">end</span>
23
+ <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>
@@ -0,0 +1,22 @@
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>camelize (Inflector)</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 147</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camelize</span>(<span class="ruby-identifier">lower_case_and_underscored_word</span>, <span class="ruby-identifier">first_letter_in_uppercase</span> = <span class="ruby-keyword kw">true</span>)
15
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">first_letter_in_uppercase</span>
16
+ <span class="ruby-identifier">lower_case_and_underscored_word</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\/(.?)/</span>) { <span class="ruby-value str">&quot;::&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">upcase</span> }.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(^|_)(.)/</span>) { <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
17
+ <span class="ruby-keyword kw">else</span>
18
+ <span class="ruby-identifier">lower_case_and_underscored_word</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">camelize</span>(<span class="ruby-identifier">lower_case_and_underscored_word</span>)[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
19
+ <span class="ruby-keyword kw">end</span>
20
+ <span class="ruby-keyword kw">end</span></pre>
21
+ </body>
22
+ </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>titleize (Inflector)</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 164</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">titleize</span>(<span class="ruby-identifier">word</span>)
15
+ <span class="ruby-identifier">humanize</span>(<span class="ruby-identifier">underscore</span>(<span class="ruby-identifier">word</span>)).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\b([a-z])/</span>) { <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">capitalize</span> }
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,22 @@
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>underscore (Inflector)</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 175</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">underscore</span>(<span class="ruby-identifier">camel_cased_word</span>)
15
+ <span class="ruby-identifier">camel_cased_word</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/::/</span>, <span class="ruby-value str">'/'</span>).
16
+ <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z][a-z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
17
+ <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z\d])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
18
+ <span class="ruby-identifier">tr</span>(<span class="ruby-value str">&quot;-&quot;</span>, <span class="ruby-value str">&quot;_&quot;</span>).
19
+ <span class="ruby-identifier">downcase</span>
20
+ <span class="ruby-keyword kw">end</span></pre>
21
+ </body>
22
+ </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>dasherize (Inflector)</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 187</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dasherize</span>(<span class="ruby-identifier">underscored_word</span>)
15
+ <span class="ruby-identifier">underscored_word</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/_/</span>, <span class="ruby-value str">'-'</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>humanize (Inflector)</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 197</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">humanize</span>(<span class="ruby-identifier">lower_case_and_underscored_word</span>)
15
+ <span class="ruby-identifier">lower_case_and_underscored_word</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/_id$/</span>, <span class="ruby-value str">&quot;&quot;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/_/</span>, <span class="ruby-value str">&quot; &quot;</span>).<span class="ruby-identifier">capitalize</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>demodulize (Inflector)</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 206</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">demodulize</span>(<span class="ruby-identifier">class_name_in_module</span>)
15
+ <span class="ruby-identifier">class_name_in_module</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^.*::/</span>, <span class="ruby-value str">''</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>tableize (Inflector)</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 217</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tableize</span>(<span class="ruby-identifier">class_name</span>)
15
+ <span class="ruby-identifier">pluralize</span>(<span class="ruby-identifier">underscore</span>(<span class="ruby-identifier">class_name</span>))
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,19 @@
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>classify (Inflector)</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 228</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">classify</span>(<span class="ruby-identifier">table_name</span>)
15
+ <span class="ruby-comment cmt"># strip out any leading schema name</span>
16
+ <span class="ruby-identifier">camelize</span>(<span class="ruby-identifier">singularize</span>(<span class="ruby-identifier">table_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/.*\./</span>, <span class="ruby-value str">''</span>)))
17
+ <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </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>foreign_key (Inflector)</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 241</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">foreign_key</span>(<span class="ruby-identifier">class_name</span>, <span class="ruby-identifier">separate_class_name_and_id_with_underscore</span> = <span class="ruby-keyword kw">true</span>)
15
+ <span class="ruby-identifier">underscore</span>(<span class="ruby-identifier">demodulize</span>(<span class="ruby-identifier">class_name</span>)) <span class="ruby-operator">+</span> (<span class="ruby-identifier">separate_class_name_and_id_with_underscore</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;_id&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;id&quot;</span>)
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,22 @@
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>constantize (Inflector)</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 252</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">constantize</span>(<span class="ruby-identifier">camel_cased_word</span>)
15
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-regexp re">/\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">camel_cased_word</span>
16
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>, <span class="ruby-node">&quot;#{camel_cased_word.inspect} is not a valid constant name!&quot;</span>
17
+ <span class="ruby-keyword kw">end</span>
18
+
19
+ <span class="ruby-constant">Object</span>.<span class="ruby-identifier">module_eval</span>(<span class="ruby-node">&quot;::#{$1}&quot;</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>)
20
+ <span class="ruby-keyword kw">end</span></pre>
21
+ </body>
22
+ </html>
@@ -0,0 +1,27 @@
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>ordinalize (Inflector)</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 268</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ordinalize</span>(<span class="ruby-identifier">number</span>)
15
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-value">11</span><span class="ruby-operator">..</span><span class="ruby-value">13</span>).<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">number</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">%</span> <span class="ruby-value">100</span>)
16
+ <span class="ruby-node">&quot;#{number}th&quot;</span>
17
+ <span class="ruby-keyword kw">else</span>
18
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">number</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">%</span> <span class="ruby-value">10</span>
19
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span>; <span class="ruby-node">&quot;#{number}st&quot;</span>
20
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span>; <span class="ruby-node">&quot;#{number}nd&quot;</span>
21
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value">3</span>; <span class="ruby-node">&quot;#{number}rd&quot;</span>
22
+ <span class="ruby-keyword kw">else</span> <span class="ruby-node">&quot;#{number}th&quot;</span>
23
+ <span class="ruby-keyword kw">end</span>
24
+ <span class="ruby-keyword kw">end</span>
25
+ <span class="ruby-keyword kw">end</span></pre>
26
+ </body>
27
+ </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#M000009">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 &quot;equipment&quot;
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#M000026">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="#M000028">clear</a>&nbsp;&nbsp;
115
+ <a href="#M000026">irregular</a>&nbsp;&nbsp;
116
+ <a href="#M000023">new</a>&nbsp;&nbsp;
117
+ <a href="#M000024">plural</a>&nbsp;&nbsp;
118
+ <a href="#M000025">singular</a>&nbsp;&nbsp;
119
+ <a href="#M000027">uncountable</a>&nbsp;&nbsp;
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">&nbsp;[R]&nbsp;</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">&nbsp;[R]&nbsp;</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">&nbsp;[R]&nbsp;</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-M000023" class="method-detail">
172
+ <a name="M000023"></a>
173
+
174
+ <div class="method-heading">
175
+ <a href="Inflections.src/M000023.html" target="Code" class="method-signature"
176
+ onclick="popupCode('Inflections.src/M000023.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-M000028" class="method-detail">
188
+ <a name="M000028"></a>
189
+
190
+ <div class="method-heading">
191
+ <a href="Inflections.src/M000028.html" target="Code" class="method-signature"
192
+ onclick="popupCode('Inflections.src/M000028.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-M000026" class="method-detail">
214
+ <a name="M000026"></a>
215
+
216
+ <div class="method-heading">
217
+ <a href="Inflections.src/M000026.html" target="Code" class="method-signature"
218
+ onclick="popupCode('Inflections.src/M000026.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#M000023">new</a> <a
226
+ href="Inflections.html#M000026">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#M000026">irregular</a> in <a
230
+ href="Inflections.html#M000025">singular</a> and <a
231
+ href="Inflections.html#M000024">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-M000024" class="method-detail">
244
+ <a name="M000024"></a>
245
+
246
+ <div class="method-heading">
247
+ <a href="Inflections.src/M000024.html" target="Code" class="method-signature"
248
+ onclick="popupCode('Inflections.src/M000024.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#M000023">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-M000025" class="method-detail">
264
+ <a name="M000025"></a>
265
+
266
+ <div class="method-heading">
267
+ <a href="Inflections.src/M000025.html" target="Code" class="method-signature"
268
+ onclick="popupCode('Inflections.src/M000025.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#M000023">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-M000027" class="method-detail">
284
+ <a name="M000027"></a>
285
+
286
+ <div class="method-heading">
287
+ <a href="Inflections.src/M000027.html" target="Code" class="method-signature"
288
+ onclick="popupCode('Inflections.src/M000027.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#M000027">uncountable</a> words that
296
+ shouldn&#8216;t be attempted inflected.
297
+ </p>
298
+ <p>
299
+ Examples:
300
+ </p>
301
+ <pre>
302
+ uncountable &quot;money&quot;
303
+ uncountable &quot;money&quot;, &quot;information&quot;
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>