simplemapper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/LICENSE +16 -0
  2. data/README +0 -0
  3. data/Rakefile +78 -0
  4. data/doc/classes/Array.html +139 -0
  5. data/doc/classes/Array.src/M000001.html +34 -0
  6. data/doc/classes/Callbacks.html +161 -0
  7. data/doc/classes/Callbacks.src/M000037.html +18 -0
  8. data/doc/classes/Callbacks.src/M000038.html +18 -0
  9. data/doc/classes/Callbacks.src/M000039.html +19 -0
  10. data/doc/classes/Enumerable.html +131 -0
  11. data/doc/classes/Enumerable.src/M000040.html +21 -0
  12. data/doc/classes/Hash.html +154 -0
  13. data/doc/classes/Hash.src/M000002.html +18 -0
  14. data/doc/classes/Hash.src/M000003.html +34 -0
  15. data/doc/classes/Inflector/Inflections.html +323 -0
  16. data/doc/classes/Inflector/Inflections.src/M000031.html +18 -0
  17. data/doc/classes/Inflector/Inflections.src/M000032.html +18 -0
  18. data/doc/classes/Inflector/Inflections.src/M000033.html +18 -0
  19. data/doc/classes/Inflector/Inflections.src/M000034.html +19 -0
  20. data/doc/classes/Inflector/Inflections.src/M000035.html +18 -0
  21. data/doc/classes/Inflector/Inflections.src/M000036.html +23 -0
  22. data/doc/classes/Inflector.html +516 -0
  23. data/doc/classes/Inflector.src/M000017.html +22 -0
  24. data/doc/classes/Inflector.src/M000018.html +25 -0
  25. data/doc/classes/Inflector.src/M000019.html +25 -0
  26. data/doc/classes/Inflector.src/M000020.html +22 -0
  27. data/doc/classes/Inflector.src/M000021.html +18 -0
  28. data/doc/classes/Inflector.src/M000022.html +22 -0
  29. data/doc/classes/Inflector.src/M000023.html +18 -0
  30. data/doc/classes/Inflector.src/M000024.html +18 -0
  31. data/doc/classes/Inflector.src/M000025.html +18 -0
  32. data/doc/classes/Inflector.src/M000026.html +18 -0
  33. data/doc/classes/Inflector.src/M000027.html +19 -0
  34. data/doc/classes/Inflector.src/M000028.html +18 -0
  35. data/doc/classes/Inflector.src/M000029.html +22 -0
  36. data/doc/classes/Inflector.src/M000030.html +27 -0
  37. data/doc/classes/Merb/Request.html +139 -0
  38. data/doc/classes/Merb/Request.src/M000041.html +22 -0
  39. data/doc/classes/Merb.html +111 -0
  40. data/doc/classes/OAuth/RequestProxy/Base.html +139 -0
  41. data/doc/classes/OAuth/RequestProxy/Base.src/M000012.html +18 -0
  42. data/doc/classes/OAuth/RequestProxy.html +111 -0
  43. data/doc/classes/OAuth/Signature/Base.html +139 -0
  44. data/doc/classes/OAuth/Signature/Base.src/M000011.html +25 -0
  45. data/doc/classes/OAuth/Signature.html +111 -0
  46. data/doc/classes/OAuth.html +112 -0
  47. data/doc/classes/OAuthController.html +243 -0
  48. data/doc/classes/OAuthController.src/M000005.html +22 -0
  49. data/doc/classes/OAuthController.src/M000006.html +18 -0
  50. data/doc/classes/OAuthController.src/M000007.html +18 -0
  51. data/doc/classes/OAuthController.src/M000008.html +25 -0
  52. data/doc/classes/OAuthController.src/M000009.html +19 -0
  53. data/doc/classes/Object.html +142 -0
  54. data/doc/classes/Object.src/M000010.html +19 -0
  55. data/doc/classes/Proc.html +143 -0
  56. data/doc/classes/Proc.src/M000004.html +18 -0
  57. data/doc/classes/Serialize.html +189 -0
  58. data/doc/classes/Serialize.src/M000013.html +21 -0
  59. data/doc/classes/Serialize.src/M000014.html +39 -0
  60. data/doc/classes/Serialize.src/M000015.html +16 -0
  61. data/doc/classes/Serialize.src/M000016.html +46 -0
  62. data/doc/classes/SimpleMapper/Base.html +528 -0
  63. data/doc/classes/SimpleMapper/Base.src/M000064.html +16 -0
  64. data/doc/classes/SimpleMapper/Base.src/M000065.html +16 -0
  65. data/doc/classes/SimpleMapper/Base.src/M000066.html +22 -0
  66. data/doc/classes/SimpleMapper/Base.src/M000067.html +21 -0
  67. data/doc/classes/SimpleMapper/Base.src/M000068.html +26 -0
  68. data/doc/classes/SimpleMapper/Base.src/M000069.html +18 -0
  69. data/doc/classes/SimpleMapper/Base.src/M000070.html +18 -0
  70. data/doc/classes/SimpleMapper/Base.src/M000071.html +18 -0
  71. data/doc/classes/SimpleMapper/Base.src/M000072.html +19 -0
  72. data/doc/classes/SimpleMapper/Base.src/M000073.html +23 -0
  73. data/doc/classes/SimpleMapper/Base.src/M000074.html +18 -0
  74. data/doc/classes/SimpleMapper/Base.src/M000075.html +20 -0
  75. data/doc/classes/SimpleMapper/Base.src/M000076.html +18 -0
  76. data/doc/classes/SimpleMapper/Base.src/M000077.html +18 -0
  77. data/doc/classes/SimpleMapper/Base.src/M000078.html +19 -0
  78. data/doc/classes/SimpleMapper/Base.src/M000079.html +18 -0
  79. data/doc/classes/SimpleMapper/Base.src/M000080.html +18 -0
  80. data/doc/classes/SimpleMapper/Base.src/M000081.html +19 -0
  81. data/doc/classes/SimpleMapper/Base.src/M000082.html +20 -0
  82. data/doc/classes/SimpleMapper/Base.src/M000083.html +24 -0
  83. data/doc/classes/SimpleMapper/Base.src/M000084.html +18 -0
  84. data/doc/classes/SimpleMapper/HttpAdapter.html +280 -0
  85. data/doc/classes/SimpleMapper/HttpAdapter.src/M000056.html +18 -0
  86. data/doc/classes/SimpleMapper/HttpAdapter.src/M000057.html +18 -0
  87. data/doc/classes/SimpleMapper/HttpAdapter.src/M000058.html +19 -0
  88. data/doc/classes/SimpleMapper/HttpAdapter.src/M000060.html +18 -0
  89. data/doc/classes/SimpleMapper/HttpAdapter.src/M000061.html +18 -0
  90. data/doc/classes/SimpleMapper/HttpAdapter.src/M000062.html +18 -0
  91. data/doc/classes/SimpleMapper/HttpAdapter.src/M000063.html +18 -0
  92. data/doc/classes/SimpleMapper/HttpOAuthExtension.html +188 -0
  93. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000048.html +49 -0
  94. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000049.html +23 -0
  95. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000050.html +18 -0
  96. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000051.html +24 -0
  97. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.html +146 -0
  98. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/M000046.html +19 -0
  99. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/M000047.html +19 -0
  100. data/doc/classes/SimpleMapper/SimpleModel.html +184 -0
  101. data/doc/classes/SimpleMapper/SimpleModel.src/M000042.html +18 -0
  102. data/doc/classes/SimpleMapper/SimpleModel.src/M000043.html +18 -0
  103. data/doc/classes/SimpleMapper/SimpleModel.src/M000044.html +18 -0
  104. data/doc/classes/SimpleMapper/SimpleModel.src/M000045.html +24 -0
  105. data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.html +152 -0
  106. data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.src/M000055.html +30 -0
  107. data/doc/classes/SimpleMapper/XmlFormat.html +169 -0
  108. data/doc/classes/SimpleMapper/XmlFormat.src/M000052.html +18 -0
  109. data/doc/classes/SimpleMapper/XmlFormat.src/M000053.html +18 -0
  110. data/doc/classes/SimpleMapper/XmlFormat.src/M000054.html +18 -0
  111. data/doc/classes/SimpleMapper.html +146 -0
  112. data/doc/classes/String.html +120 -0
  113. data/doc/created.rid +1 -0
  114. data/doc/files/lib/simple_mapper/adapters/http_adapter_rb.html +110 -0
  115. data/doc/files/lib/simple_mapper/base_rb.html +108 -0
  116. data/doc/files/lib/simple_mapper/default_plugins/callbacks_rb.html +101 -0
  117. data/doc/files/lib/simple_mapper/default_plugins/oauth_rb.html +116 -0
  118. data/doc/files/lib/simple_mapper/default_plugins/simple_model_rb.html +101 -0
  119. data/doc/files/lib/simple_mapper/formats/xml_format_rb.html +108 -0
  120. data/doc/files/lib/simple_mapper/support/bliss_serializer_rb.html +109 -0
  121. data/doc/files/lib/simple_mapper/support/core_ext_rb.html +108 -0
  122. data/doc/files/lib/simple_mapper/support/inflections_rb.html +101 -0
  123. data/doc/files/lib/simple_mapper/support/inflector_rb.html +108 -0
  124. data/doc/files/lib/simple_mapper/support_rb.html +109 -0
  125. data/doc/files/lib/simple_mapper_rb.html +137 -0
  126. data/doc/fr_class_index.html +52 -0
  127. data/doc/fr_file_index.html +38 -0
  128. data/doc/fr_method_index.html +110 -0
  129. data/doc/index.html +24 -0
  130. data/doc/rdoc-style.css +208 -0
  131. data/lib/simple_mapper/adapters/http_adapter.rb +64 -0
  132. data/lib/simple_mapper/base.rb +138 -0
  133. data/lib/simple_mapper/default_plugins/callbacks.rb +12 -0
  134. data/lib/simple_mapper/default_plugins/oauth.rb +167 -0
  135. data/lib/simple_mapper/default_plugins/simple_model.rb +36 -0
  136. data/lib/simple_mapper/formats/xml_format.rb +48 -0
  137. data/lib/simple_mapper/support/bliss_serializer.rb +168 -0
  138. data/lib/simple_mapper/support/core_ext.rb +73 -0
  139. data/lib/simple_mapper/support/inflections.rb +112 -0
  140. data/lib/simple_mapper/support/inflector.rb +275 -0
  141. data/lib/simple_mapper/support.rb +2 -0
  142. data/lib/simple_mapper.rb +16 -0
  143. metadata +236 -0
@@ -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/simple_mapper/support/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/simple_mapper/support/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/simple_mapper/support/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,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>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/simple_mapper/support/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-identifier">plural</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;(#{singular[0,1]})#{singular[1..-1]}$&quot;</span>, <span class="ruby-value str">&quot;i&quot;</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>])
16
+ <span class="ruby-identifier">singular</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;(#{plural[0,1]})#{plural[1..-1]}$&quot;</span>, <span class="ruby-value str">&quot;i&quot;</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>])
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>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/simple_mapper/support/inflector.rb, line 60</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">&lt;&lt;</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>
@@ -0,0 +1,23 @@
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>clear (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/simple_mapper/support/inflector.rb, line 70</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>(<span class="ruby-identifier">scope</span> = <span class="ruby-identifier">:all</span>)
15
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">scope</span>
16
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:all</span>
17
+ <span class="ruby-ivar">@plurals</span>, <span class="ruby-ivar">@singulars</span>, <span class="ruby-ivar">@uncountables</span> = [], [], []
18
+ <span class="ruby-keyword kw">else</span>
19
+ <span class="ruby-identifier">instance_variable_set</span> <span class="ruby-node">&quot;@#{scope}&quot;</span>, []
20
+ <span class="ruby-keyword kw">end</span>
21
+ <span class="ruby-keyword kw">end</span></pre>
22
+ </body>
23
+ </html>
@@ -0,0 +1,516 @@
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: Inflector</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">Inflector</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/simple_mapper/support/inflector_rb.html">
59
+ lib/simple_mapper/support/inflector.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
+ <div id="description">
76
+ <p>
77
+ The <a href="Inflector.html">Inflector</a> transforms words from singular
78
+ to plural, class names to table names, modularized class names to ones
79
+ without, and class names to foreign keys. The default <a
80
+ href="Inflector.html#M000017">inflections</a> for pluralization,
81
+ singularization, and uncountable words are kept in inflections.rb.
82
+ </p>
83
+
84
+ </div>
85
+
86
+
87
+ </div>
88
+
89
+ <div id="method-list">
90
+ <h3 class="section-bar">Methods</h3>
91
+
92
+ <div class="name-list">
93
+ <a href="#M000020">camelize</a>&nbsp;&nbsp;
94
+ <a href="#M000027">classify</a>&nbsp;&nbsp;
95
+ <a href="#M000029">constantize</a>&nbsp;&nbsp;
96
+ <a href="#M000023">dasherize</a>&nbsp;&nbsp;
97
+ <a href="#M000025">demodulize</a>&nbsp;&nbsp;
98
+ <a href="#M000028">foreign_key</a>&nbsp;&nbsp;
99
+ <a href="#M000024">humanize</a>&nbsp;&nbsp;
100
+ <a href="#M000017">inflections</a>&nbsp;&nbsp;
101
+ <a href="#M000030">ordinalize</a>&nbsp;&nbsp;
102
+ <a href="#M000018">pluralize</a>&nbsp;&nbsp;
103
+ <a href="#M000019">singularize</a>&nbsp;&nbsp;
104
+ <a href="#M000026">tableize</a>&nbsp;&nbsp;
105
+ <a href="#M000021">titleize</a>&nbsp;&nbsp;
106
+ <a href="#M000022">underscore</a>&nbsp;&nbsp;
107
+ </div>
108
+ </div>
109
+
110
+ </div>
111
+
112
+
113
+ <!-- if includes -->
114
+
115
+ <div id="section">
116
+
117
+ <div id="class-list">
118
+ <h3 class="section-bar">Classes and Modules</h3>
119
+
120
+ Class <a href="Inflector/Inflections.html" class="link">Inflector::Inflections</a><br />
121
+
122
+ </div>
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+ <!-- if method_list -->
131
+ <div id="methods">
132
+ <h3 class="section-bar">Public Instance methods</h3>
133
+
134
+ <div id="method-M000020" class="method-detail">
135
+ <a name="M000020"></a>
136
+
137
+ <div class="method-heading">
138
+ <a href="Inflector.src/M000020.html" target="Code" class="method-signature"
139
+ onclick="popupCode('Inflector.src/M000020.html');return false;">
140
+ <span class="method-name">camelize</span><span class="method-args">(lower_case_and_underscored_word, first_letter_in_uppercase = true)</span>
141
+ </a>
142
+ </div>
143
+
144
+ <div class="method-description">
145
+ <p>
146
+ By default, <a href="Inflector.html#M000020">camelize</a> converts strings
147
+ to UpperCamelCase. If the argument to <a
148
+ href="Inflector.html#M000020">camelize</a> is set to &quot;:lower&quot;
149
+ then <a href="Inflector.html#M000020">camelize</a> produces lowerCamelCase.
150
+ </p>
151
+ <p>
152
+ <a href="Inflector.html#M000020">camelize</a> will also convert
153
+ &#8217;/&#8217; to &#8217;::&#8217; which is useful for converting paths to
154
+ namespaces
155
+ </p>
156
+ <p>
157
+ Examples
158
+ </p>
159
+ <pre>
160
+ &quot;active_record&quot;.camelize #=&gt; &quot;ActiveRecord&quot;
161
+ &quot;active_record&quot;.camelize(:lower) #=&gt; &quot;activeRecord&quot;
162
+ &quot;active_record/errors&quot;.camelize #=&gt; &quot;ActiveRecord::Errors&quot;
163
+ &quot;active_record/errors&quot;.camelize(:lower) #=&gt; &quot;activeRecord::Errors&quot;
164
+ </pre>
165
+ </div>
166
+ </div>
167
+
168
+ <div id="method-M000027" class="method-detail">
169
+ <a name="M000027"></a>
170
+
171
+ <div class="method-heading">
172
+ <a href="Inflector.src/M000027.html" target="Code" class="method-signature"
173
+ onclick="popupCode('Inflector.src/M000027.html');return false;">
174
+ <span class="method-name">classify</span><span class="method-args">(table_name)</span>
175
+ </a>
176
+ </div>
177
+
178
+ <div class="method-description">
179
+ <p>
180
+ Create a class name from a table name like Rails does for table names to
181
+ models. Note that this returns a string and not a Class. (To convert to an
182
+ actual class follow <a href="Inflector.html#M000027">classify</a> with <a
183
+ href="Inflector.html#M000029">constantize</a>.)
184
+ </p>
185
+ <p>
186
+ Examples
187
+ </p>
188
+ <pre>
189
+ &quot;egg_and_hams&quot;.classify #=&gt; &quot;EggAndHam&quot;
190
+ &quot;post&quot;.classify #=&gt; &quot;Post&quot;
191
+ </pre>
192
+ </div>
193
+ </div>
194
+
195
+ <div id="method-M000029" class="method-detail">
196
+ <a name="M000029"></a>
197
+
198
+ <div class="method-heading">
199
+ <a href="Inflector.src/M000029.html" target="Code" class="method-signature"
200
+ onclick="popupCode('Inflector.src/M000029.html');return false;">
201
+ <span class="method-name">constantize</span><span class="method-args">(camel_cased_word)</span>
202
+ </a>
203
+ </div>
204
+
205
+ <div class="method-description">
206
+ <p>
207
+ Constantize tries to find a declared constant with the name specified in
208
+ the string. It raises a NameError when the name is not in CamelCase or is
209
+ not initialized.
210
+ </p>
211
+ <p>
212
+ Examples
213
+ </p>
214
+ <pre>
215
+ &quot;Module&quot;.constantize #=&gt; Module
216
+ &quot;Class&quot;.constantize #=&gt; Class
217
+ </pre>
218
+ </div>
219
+ </div>
220
+
221
+ <div id="method-M000023" class="method-detail">
222
+ <a name="M000023"></a>
223
+
224
+ <div class="method-heading">
225
+ <a href="Inflector.src/M000023.html" target="Code" class="method-signature"
226
+ onclick="popupCode('Inflector.src/M000023.html');return false;">
227
+ <span class="method-name">dasherize</span><span class="method-args">(underscored_word)</span>
228
+ </a>
229
+ </div>
230
+
231
+ <div class="method-description">
232
+ <p>
233
+ Replaces underscores with dashes in the string.
234
+ </p>
235
+ <p>
236
+ Example
237
+ </p>
238
+ <pre>
239
+ &quot;puni_puni&quot; #=&gt; &quot;puni-puni&quot;
240
+ </pre>
241
+ </div>
242
+ </div>
243
+
244
+ <div id="method-M000025" class="method-detail">
245
+ <a name="M000025"></a>
246
+
247
+ <div class="method-heading">
248
+ <a href="Inflector.src/M000025.html" target="Code" class="method-signature"
249
+ onclick="popupCode('Inflector.src/M000025.html');return false;">
250
+ <span class="method-name">demodulize</span><span class="method-args">(class_name_in_module)</span>
251
+ </a>
252
+ </div>
253
+
254
+ <div class="method-description">
255
+ <p>
256
+ Removes the module part from the expression in the string
257
+ </p>
258
+ <p>
259
+ Examples
260
+ </p>
261
+ <pre>
262
+ &quot;ActiveRecord::CoreExtensions::String::Inflections&quot;.demodulize #=&gt; &quot;Inflections&quot;
263
+ &quot;Inflections&quot;.demodulize #=&gt; &quot;Inflections&quot;
264
+ </pre>
265
+ </div>
266
+ </div>
267
+
268
+ <div id="method-M000028" class="method-detail">
269
+ <a name="M000028"></a>
270
+
271
+ <div class="method-heading">
272
+ <a href="Inflector.src/M000028.html" target="Code" class="method-signature"
273
+ onclick="popupCode('Inflector.src/M000028.html');return false;">
274
+ <span class="method-name">foreign_key</span><span class="method-args">(class_name, separate_class_name_and_id_with_underscore = true)</span>
275
+ </a>
276
+ </div>
277
+
278
+ <div class="method-description">
279
+ <p>
280
+ Creates a foreign key name from a class name.
281
+ <tt>separate_class_name_and_id_with_underscore</tt> sets whether the method
282
+ should put &#8216;_&#8217; between the name and &#8216;id&#8217;.
283
+ </p>
284
+ <p>
285
+ Examples
286
+ </p>
287
+ <pre>
288
+ &quot;Message&quot;.foreign_key #=&gt; &quot;message_id&quot;
289
+ &quot;Message&quot;.foreign_key(false) #=&gt; &quot;messageid&quot;
290
+ &quot;Admin::Post&quot;.foreign_key #=&gt; &quot;post_id&quot;
291
+ </pre>
292
+ </div>
293
+ </div>
294
+
295
+ <div id="method-M000024" class="method-detail">
296
+ <a name="M000024"></a>
297
+
298
+ <div class="method-heading">
299
+ <a href="Inflector.src/M000024.html" target="Code" class="method-signature"
300
+ onclick="popupCode('Inflector.src/M000024.html');return false;">
301
+ <span class="method-name">humanize</span><span class="method-args">(lower_case_and_underscored_word)</span>
302
+ </a>
303
+ </div>
304
+
305
+ <div class="method-description">
306
+ <p>
307
+ Capitalizes the first word and turns underscores into spaces and strips
308
+ _id. Like <a href="Inflector.html#M000021">titleize</a>, this is meant for
309
+ creating pretty output.
310
+ </p>
311
+ <p>
312
+ Examples
313
+ </p>
314
+ <pre>
315
+ &quot;employee_salary&quot; #=&gt; &quot;Employee salary&quot;
316
+ &quot;author_id&quot; #=&gt; &quot;Author&quot;
317
+ </pre>
318
+ </div>
319
+ </div>
320
+
321
+ <div id="method-M000017" class="method-detail">
322
+ <a name="M000017"></a>
323
+
324
+ <div class="method-heading">
325
+ <a href="Inflector.src/M000017.html" target="Code" class="method-signature"
326
+ onclick="popupCode('Inflector.src/M000017.html');return false;">
327
+ <span class="method-name">inflections</span><span class="method-args">() {|Inflections.instance| ...}</span>
328
+ </a>
329
+ </div>
330
+
331
+ <div class="method-description">
332
+ </div>
333
+ </div>
334
+
335
+ <div id="method-M000030" class="method-detail">
336
+ <a name="M000030"></a>
337
+
338
+ <div class="method-heading">
339
+ <a href="Inflector.src/M000030.html" target="Code" class="method-signature"
340
+ onclick="popupCode('Inflector.src/M000030.html');return false;">
341
+ <span class="method-name">ordinalize</span><span class="method-args">(number)</span>
342
+ </a>
343
+ </div>
344
+
345
+ <div class="method-description">
346
+ <p>
347
+ Ordinalize turns a number into an ordinal string used to denote the
348
+ position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
349
+ </p>
350
+ <p>
351
+ Examples
352
+ </p>
353
+ <pre>
354
+ ordinalize(1) # =&gt; &quot;1st&quot;
355
+ ordinalize(2) # =&gt; &quot;2nd&quot;
356
+ ordinalize(1002) # =&gt; &quot;1002nd&quot;
357
+ ordinalize(1003) # =&gt; &quot;1003rd&quot;
358
+ </pre>
359
+ </div>
360
+ </div>
361
+
362
+ <div id="method-M000018" class="method-detail">
363
+ <a name="M000018"></a>
364
+
365
+ <div class="method-heading">
366
+ <a href="Inflector.src/M000018.html" target="Code" class="method-signature"
367
+ onclick="popupCode('Inflector.src/M000018.html');return false;">
368
+ <span class="method-name">pluralize</span><span class="method-args">(word)</span>
369
+ </a>
370
+ </div>
371
+
372
+ <div class="method-description">
373
+ <p>
374
+ Returns the plural form of the word in the string.
375
+ </p>
376
+ <p>
377
+ Examples
378
+ </p>
379
+ <pre>
380
+ &quot;post&quot;.pluralize #=&gt; &quot;posts&quot;
381
+ &quot;octopus&quot;.pluralize #=&gt; &quot;octopi&quot;
382
+ &quot;sheep&quot;.pluralize #=&gt; &quot;sheep&quot;
383
+ &quot;words&quot;.pluralize #=&gt; &quot;words&quot;
384
+ &quot;the blue mailman&quot;.pluralize #=&gt; &quot;the blue mailmen&quot;
385
+ &quot;CamelOctopus&quot;.pluralize #=&gt; &quot;CamelOctopi&quot;
386
+ </pre>
387
+ </div>
388
+ </div>
389
+
390
+ <div id="method-M000019" class="method-detail">
391
+ <a name="M000019"></a>
392
+
393
+ <div class="method-heading">
394
+ <a href="Inflector.src/M000019.html" target="Code" class="method-signature"
395
+ onclick="popupCode('Inflector.src/M000019.html');return false;">
396
+ <span class="method-name">singularize</span><span class="method-args">(word)</span>
397
+ </a>
398
+ </div>
399
+
400
+ <div class="method-description">
401
+ <p>
402
+ The reverse of <a href="Inflector.html#M000018">pluralize</a>, returns the
403
+ singular form of a word in a string.
404
+ </p>
405
+ <p>
406
+ Examples
407
+ </p>
408
+ <pre>
409
+ &quot;posts&quot;.singularize #=&gt; &quot;post&quot;
410
+ &quot;octopi&quot;.singularize #=&gt; &quot;octopus&quot;
411
+ &quot;sheep&quot;.singluarize #=&gt; &quot;sheep&quot;
412
+ &quot;word&quot;.singluarize #=&gt; &quot;word&quot;
413
+ &quot;the blue mailmen&quot;.singularize #=&gt; &quot;the blue mailman&quot;
414
+ &quot;CamelOctopi&quot;.singularize #=&gt; &quot;CamelOctopus&quot;
415
+ </pre>
416
+ </div>
417
+ </div>
418
+
419
+ <div id="method-M000026" class="method-detail">
420
+ <a name="M000026"></a>
421
+
422
+ <div class="method-heading">
423
+ <a href="Inflector.src/M000026.html" target="Code" class="method-signature"
424
+ onclick="popupCode('Inflector.src/M000026.html');return false;">
425
+ <span class="method-name">tableize</span><span class="method-args">(class_name)</span>
426
+ </a>
427
+ </div>
428
+
429
+ <div class="method-description">
430
+ <p>
431
+ Create the name of a table like Rails does for models to table names. This
432
+ method uses the <a href="Inflector.html#M000018">pluralize</a> method on
433
+ the last word in the string.
434
+ </p>
435
+ <p>
436
+ Examples
437
+ </p>
438
+ <pre>
439
+ &quot;RawScaledScorer&quot;.tableize #=&gt; &quot;raw_scaled_scorers&quot;
440
+ &quot;egg_and_ham&quot;.tableize #=&gt; &quot;egg_and_hams&quot;
441
+ &quot;fancyCategory&quot;.tableize #=&gt; &quot;fancy_categories&quot;
442
+ </pre>
443
+ </div>
444
+ </div>
445
+
446
+ <div id="method-M000021" class="method-detail">
447
+ <a name="M000021"></a>
448
+
449
+ <div class="method-heading">
450
+ <a href="Inflector.src/M000021.html" target="Code" class="method-signature"
451
+ onclick="popupCode('Inflector.src/M000021.html');return false;">
452
+ <span class="method-name">titleize</span><span class="method-args">(word)</span>
453
+ </a>
454
+ </div>
455
+
456
+ <div class="method-description">
457
+ <p>
458
+ Capitalizes all the words and replaces some characters in the string to
459
+ create a nicer looking title. Titleize is meant for creating pretty output.
460
+ It is not used in the Rails internals.
461
+ </p>
462
+ <p>
463
+ <a href="Inflector.html#M000021">titleize</a> is also aliased as as
464
+ titlecase
465
+ </p>
466
+ <p>
467
+ Examples
468
+ </p>
469
+ <pre>
470
+ &quot;man from the boondocks&quot;.titleize #=&gt; &quot;Man From The Boondocks&quot;
471
+ &quot;x-men: the last stand&quot;.titleize #=&gt; &quot;X Men: The Last Stand&quot;
472
+ </pre>
473
+ </div>
474
+ </div>
475
+
476
+ <div id="method-M000022" class="method-detail">
477
+ <a name="M000022"></a>
478
+
479
+ <div class="method-heading">
480
+ <a href="Inflector.src/M000022.html" target="Code" class="method-signature"
481
+ onclick="popupCode('Inflector.src/M000022.html');return false;">
482
+ <span class="method-name">underscore</span><span class="method-args">(camel_cased_word)</span>
483
+ </a>
484
+ </div>
485
+
486
+ <div class="method-description">
487
+ <p>
488
+ The reverse of <tt><a href="Inflector.html#M000020">camelize</a></tt>.
489
+ Makes an underscored form from the expression in the string.
490
+ </p>
491
+ <p>
492
+ Changes &#8217;::&#8217; to &#8217;/&#8217; to convert namespaces to paths.
493
+ </p>
494
+ <p>
495
+ Examples
496
+ </p>
497
+ <pre>
498
+ &quot;ActiveRecord&quot;.underscore #=&gt; &quot;active_record&quot;
499
+ &quot;ActiveRecord::Errors&quot;.underscore #=&gt; active_record/errors
500
+ </pre>
501
+ </div>
502
+ </div>
503
+
504
+
505
+ </div>
506
+
507
+
508
+ </div>
509
+
510
+
511
+ <div id="validator-badges">
512
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
513
+ </div>
514
+
515
+ </body>
516
+ </html>