simplemapper 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. data/Rakefile +1 -1
  2. data/lib/simple_mapper/adapters/http_adapter.rb +36 -5
  3. data/lib/simple_mapper/base.rb +5 -175
  4. data/lib/simple_mapper/default_plugins/associations.rb +374 -0
  5. data/lib/simple_mapper/default_plugins/properties.rb +70 -0
  6. data/lib/simple_mapper/persistence.rb +169 -0
  7. data/lib/simple_mapper/plugin_support.rb +19 -0
  8. data/lib/simple_mapper/support.rb +2 -2
  9. data/lib/simple_mapper/support/bliss_serializer.rb +43 -12
  10. data/lib/simple_mapper/support/core_ext.rb +23 -2
  11. metadata +6 -179
  12. data/doc/classes/Array.html +0 -158
  13. data/doc/classes/Array.src/M000005.html +0 -18
  14. data/doc/classes/Array.src/M000006.html +0 -34
  15. data/doc/classes/Enumerable.html +0 -131
  16. data/doc/classes/Enumerable.src/M000040.html +0 -21
  17. data/doc/classes/Hash.html +0 -173
  18. data/doc/classes/Hash.src/M000002.html +0 -20
  19. data/doc/classes/Hash.src/M000003.html +0 -18
  20. data/doc/classes/Hash.src/M000004.html +0 -34
  21. data/doc/classes/Inflector.html +0 -516
  22. data/doc/classes/Inflector.src/M000020.html +0 -22
  23. data/doc/classes/Inflector.src/M000021.html +0 -25
  24. data/doc/classes/Inflector.src/M000022.html +0 -25
  25. data/doc/classes/Inflector.src/M000023.html +0 -22
  26. data/doc/classes/Inflector.src/M000024.html +0 -18
  27. data/doc/classes/Inflector.src/M000025.html +0 -22
  28. data/doc/classes/Inflector.src/M000026.html +0 -18
  29. data/doc/classes/Inflector.src/M000027.html +0 -18
  30. data/doc/classes/Inflector.src/M000028.html +0 -18
  31. data/doc/classes/Inflector.src/M000029.html +0 -18
  32. data/doc/classes/Inflector.src/M000030.html +0 -19
  33. data/doc/classes/Inflector.src/M000031.html +0 -18
  34. data/doc/classes/Inflector.src/M000032.html +0 -22
  35. data/doc/classes/Inflector.src/M000033.html +0 -27
  36. data/doc/classes/Inflector/Inflections.html +0 -323
  37. data/doc/classes/Inflector/Inflections.src/M000034.html +0 -18
  38. data/doc/classes/Inflector/Inflections.src/M000035.html +0 -18
  39. data/doc/classes/Inflector/Inflections.src/M000036.html +0 -18
  40. data/doc/classes/Inflector/Inflections.src/M000037.html +0 -19
  41. data/doc/classes/Inflector/Inflections.src/M000038.html +0 -18
  42. data/doc/classes/Inflector/Inflections.src/M000039.html +0 -23
  43. data/doc/classes/Merb.html +0 -111
  44. data/doc/classes/Merb/Request.html +0 -139
  45. data/doc/classes/Merb/Request.src/M000041.html +0 -22
  46. data/doc/classes/OAuth.html +0 -112
  47. data/doc/classes/OAuth/RequestProxy.html +0 -111
  48. data/doc/classes/OAuth/RequestProxy/Base.html +0 -139
  49. data/doc/classes/OAuth/RequestProxy/Base.src/M000015.html +0 -18
  50. data/doc/classes/OAuth/Signature.html +0 -111
  51. data/doc/classes/OAuth/Signature/Base.html +0 -139
  52. data/doc/classes/OAuth/Signature/Base.src/M000014.html +0 -25
  53. data/doc/classes/OAuthController.html +0 -243
  54. data/doc/classes/OAuthController.src/M000008.html +0 -22
  55. data/doc/classes/OAuthController.src/M000009.html +0 -18
  56. data/doc/classes/OAuthController.src/M000010.html +0 -18
  57. data/doc/classes/OAuthController.src/M000011.html +0 -25
  58. data/doc/classes/OAuthController.src/M000012.html +0 -19
  59. data/doc/classes/Object.html +0 -154
  60. data/doc/classes/Object.src/M000013.html +0 -19
  61. data/doc/classes/Proc.html +0 -143
  62. data/doc/classes/Proc.src/M000007.html +0 -18
  63. data/doc/classes/Serialize.html +0 -189
  64. data/doc/classes/Serialize.src/M000016.html +0 -21
  65. data/doc/classes/Serialize.src/M000017.html +0 -39
  66. data/doc/classes/Serialize.src/M000018.html +0 -16
  67. data/doc/classes/Serialize.src/M000019.html +0 -18
  68. data/doc/classes/SimpleMapper.html +0 -151
  69. data/doc/classes/SimpleMapper/Base.html +0 -621
  70. data/doc/classes/SimpleMapper/Base.src/M000067.html +0 -16
  71. data/doc/classes/SimpleMapper/Base.src/M000068.html +0 -16
  72. data/doc/classes/SimpleMapper/Base.src/M000069.html +0 -18
  73. data/doc/classes/SimpleMapper/Base.src/M000070.html +0 -29
  74. data/doc/classes/SimpleMapper/Base.src/M000071.html +0 -18
  75. data/doc/classes/SimpleMapper/Base.src/M000072.html +0 -21
  76. data/doc/classes/SimpleMapper/Base.src/M000073.html +0 -18
  77. data/doc/classes/SimpleMapper/Base.src/M000074.html +0 -27
  78. data/doc/classes/SimpleMapper/Base.src/M000075.html +0 -21
  79. data/doc/classes/SimpleMapper/Base.src/M000076.html +0 -18
  80. data/doc/classes/SimpleMapper/Base.src/M000077.html +0 -18
  81. data/doc/classes/SimpleMapper/Base.src/M000078.html +0 -19
  82. data/doc/classes/SimpleMapper/Base.src/M000079.html +0 -23
  83. data/doc/classes/SimpleMapper/Base.src/M000080.html +0 -21
  84. data/doc/classes/SimpleMapper/Base.src/M000081.html +0 -18
  85. data/doc/classes/SimpleMapper/Base.src/M000082.html +0 -19
  86. data/doc/classes/SimpleMapper/Base.src/M000083.html +0 -18
  87. data/doc/classes/SimpleMapper/Base.src/M000085.html +0 -18
  88. data/doc/classes/SimpleMapper/Base.src/M000086.html +0 -19
  89. data/doc/classes/SimpleMapper/Base.src/M000087.html +0 -18
  90. data/doc/classes/SimpleMapper/Base.src/M000088.html +0 -18
  91. data/doc/classes/SimpleMapper/Base.src/M000089.html +0 -18
  92. data/doc/classes/SimpleMapper/Base.src/M000090.html +0 -19
  93. data/doc/classes/SimpleMapper/Base.src/M000091.html +0 -20
  94. data/doc/classes/SimpleMapper/Base.src/M000092.html +0 -24
  95. data/doc/classes/SimpleMapper/Base.src/M000093.html +0 -18
  96. data/doc/classes/SimpleMapper/CallbacksExtension.html +0 -161
  97. data/doc/classes/SimpleMapper/CallbacksExtension.src/M000056.html +0 -18
  98. data/doc/classes/SimpleMapper/CallbacksExtension.src/M000057.html +0 -18
  99. data/doc/classes/SimpleMapper/CallbacksExtension.src/M000058.html +0 -19
  100. data/doc/classes/SimpleMapper/HttpAdapter.html +0 -289
  101. data/doc/classes/SimpleMapper/HttpAdapter.src/M000059.html +0 -18
  102. data/doc/classes/SimpleMapper/HttpAdapter.src/M000060.html +0 -18
  103. data/doc/classes/SimpleMapper/HttpAdapter.src/M000061.html +0 -19
  104. data/doc/classes/SimpleMapper/HttpAdapter.src/M000063.html +0 -19
  105. data/doc/classes/SimpleMapper/HttpAdapter.src/M000064.html +0 -18
  106. data/doc/classes/SimpleMapper/HttpAdapter.src/M000065.html +0 -18
  107. data/doc/classes/SimpleMapper/HttpAdapter.src/M000066.html +0 -18
  108. data/doc/classes/SimpleMapper/HttpOAuthExtension.html +0 -188
  109. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000048.html +0 -47
  110. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000049.html +0 -21
  111. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000050.html +0 -18
  112. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000051.html +0 -24
  113. data/doc/classes/SimpleMapper/SimpleModel.html +0 -184
  114. data/doc/classes/SimpleMapper/SimpleModel.src/M000042.html +0 -18
  115. data/doc/classes/SimpleMapper/SimpleModel.src/M000043.html +0 -18
  116. data/doc/classes/SimpleMapper/SimpleModel.src/M000044.html +0 -18
  117. data/doc/classes/SimpleMapper/SimpleModel.src/M000045.html +0 -24
  118. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.html +0 -146
  119. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/M000046.html +0 -19
  120. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/M000047.html +0 -19
  121. data/doc/classes/SimpleMapper/XmlFormat.html +0 -169
  122. data/doc/classes/SimpleMapper/XmlFormat.src/M000052.html +0 -18
  123. data/doc/classes/SimpleMapper/XmlFormat.src/M000053.html +0 -18
  124. data/doc/classes/SimpleMapper/XmlFormat.src/M000054.html +0 -20
  125. data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.html +0 -152
  126. data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.src/M000055.html +0 -32
  127. data/doc/classes/String.html +0 -120
  128. data/doc/classes/Time.html +0 -139
  129. data/doc/classes/Time.src/M000001.html +0 -18
  130. data/doc/created.rid +0 -1
  131. data/doc/files/LICENSE.html +0 -129
  132. data/doc/files/README.html +0 -130
  133. data/doc/files/lib/simple_mapper/adapters/http_adapter_rb.html +0 -111
  134. data/doc/files/lib/simple_mapper/base_rb.html +0 -108
  135. data/doc/files/lib/simple_mapper/default_plugins/callbacks_rb.html +0 -101
  136. data/doc/files/lib/simple_mapper/default_plugins/oauth_rb.html +0 -110
  137. data/doc/files/lib/simple_mapper/default_plugins/options_to_query_rb.html +0 -116
  138. data/doc/files/lib/simple_mapper/default_plugins/simple_model_rb.html +0 -101
  139. data/doc/files/lib/simple_mapper/formats/xml_format_rb.html +0 -110
  140. data/doc/files/lib/simple_mapper/support/bliss_serializer_rb.html +0 -110
  141. data/doc/files/lib/simple_mapper/support/core_ext_rb.html +0 -108
  142. data/doc/files/lib/simple_mapper/support/inflections_rb.html +0 -101
  143. data/doc/files/lib/simple_mapper/support/inflector_rb.html +0 -108
  144. data/doc/files/lib/simple_mapper/support_rb.html +0 -109
  145. data/doc/files/lib/simple_mapper_rb.html +0 -137
  146. data/doc/fr_class_index.html +0 -53
  147. data/doc/fr_file_index.html +0 -41
  148. data/doc/fr_method_index.html +0 -119
  149. data/doc/index.html +0 -24
  150. data/doc/rdoc-style.css +0 -208
  151. data/lib/simple_mapper/default_plugins/simple_model.rb +0 -36
@@ -1,20 +0,0 @@
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>to_query (Hash)</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/default_plugins/options_to_query.rb, line 18</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_query</span>(<span class="ruby-identifier">namespace</span>=<span class="ruby-keyword kw">nil</span>)
15
- <span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
16
- <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_query</span>(<span class="ruby-identifier">namespace</span> <span class="ruby-value">? </span><span class="ruby-node">&quot;#{namespace}[#{key}]&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">key</span>)
17
- <span class="ruby-keyword kw">end</span> <span class="ruby-operator">*</span> <span class="ruby-value str">'&amp;'</span>
18
- <span class="ruby-keyword kw">end</span></pre>
19
- </body>
20
- </html>
@@ -1,18 +0,0 @@
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>stringify_keys! (Hash)</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/core_ext.rb, line 19</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stringify_keys!</span>
15
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each_key</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>)}
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,34 +0,0 @@
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>crawl (Hash)</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/core_ext.rb, line 23</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crawl</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
15
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;no block given&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
16
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
17
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">arity</span>
18
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span>
19
- <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">v</span>)
20
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span>
21
- <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
22
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">3</span>
23
- <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>,<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
24
- <span class="ruby-identifier">v</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">k</span>]
25
- <span class="ruby-keyword kw">end</span>
26
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
27
- <span class="ruby-identifier">v</span>.<span class="ruby-identifier">crawl</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
28
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
29
- <span class="ruby-identifier">v</span>.<span class="ruby-identifier">crawl</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
30
- <span class="ruby-keyword kw">end</span>
31
- <span class="ruby-keyword kw">end</span>
32
- <span class="ruby-keyword kw">end</span></pre>
33
- </body>
34
- </html>
@@ -1,516 +0,0 @@
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#M000020">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="#M000023">camelize</a>&nbsp;&nbsp;
94
- <a href="#M000030">classify</a>&nbsp;&nbsp;
95
- <a href="#M000032">constantize</a>&nbsp;&nbsp;
96
- <a href="#M000026">dasherize</a>&nbsp;&nbsp;
97
- <a href="#M000028">demodulize</a>&nbsp;&nbsp;
98
- <a href="#M000031">foreign_key</a>&nbsp;&nbsp;
99
- <a href="#M000027">humanize</a>&nbsp;&nbsp;
100
- <a href="#M000020">inflections</a>&nbsp;&nbsp;
101
- <a href="#M000033">ordinalize</a>&nbsp;&nbsp;
102
- <a href="#M000021">pluralize</a>&nbsp;&nbsp;
103
- <a href="#M000022">singularize</a>&nbsp;&nbsp;
104
- <a href="#M000029">tableize</a>&nbsp;&nbsp;
105
- <a href="#M000024">titleize</a>&nbsp;&nbsp;
106
- <a href="#M000025">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-M000023" class="method-detail">
135
- <a name="M000023"></a>
136
-
137
- <div class="method-heading">
138
- <a href="Inflector.src/M000023.html" target="Code" class="method-signature"
139
- onclick="popupCode('Inflector.src/M000023.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#M000023">camelize</a> converts strings
147
- to UpperCamelCase. If the argument to <a
148
- href="Inflector.html#M000023">camelize</a> is set to &quot;:lower&quot;
149
- then <a href="Inflector.html#M000023">camelize</a> produces lowerCamelCase.
150
- </p>
151
- <p>
152
- <a href="Inflector.html#M000023">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-M000030" class="method-detail">
169
- <a name="M000030"></a>
170
-
171
- <div class="method-heading">
172
- <a href="Inflector.src/M000030.html" target="Code" class="method-signature"
173
- onclick="popupCode('Inflector.src/M000030.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#M000030">classify</a> with <a
183
- href="Inflector.html#M000032">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-M000032" class="method-detail">
196
- <a name="M000032"></a>
197
-
198
- <div class="method-heading">
199
- <a href="Inflector.src/M000032.html" target="Code" class="method-signature"
200
- onclick="popupCode('Inflector.src/M000032.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-M000026" class="method-detail">
222
- <a name="M000026"></a>
223
-
224
- <div class="method-heading">
225
- <a href="Inflector.src/M000026.html" target="Code" class="method-signature"
226
- onclick="popupCode('Inflector.src/M000026.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-M000028" class="method-detail">
245
- <a name="M000028"></a>
246
-
247
- <div class="method-heading">
248
- <a href="Inflector.src/M000028.html" target="Code" class="method-signature"
249
- onclick="popupCode('Inflector.src/M000028.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-M000031" class="method-detail">
269
- <a name="M000031"></a>
270
-
271
- <div class="method-heading">
272
- <a href="Inflector.src/M000031.html" target="Code" class="method-signature"
273
- onclick="popupCode('Inflector.src/M000031.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-M000027" class="method-detail">
296
- <a name="M000027"></a>
297
-
298
- <div class="method-heading">
299
- <a href="Inflector.src/M000027.html" target="Code" class="method-signature"
300
- onclick="popupCode('Inflector.src/M000027.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#M000024">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-M000020" class="method-detail">
322
- <a name="M000020"></a>
323
-
324
- <div class="method-heading">
325
- <a href="Inflector.src/M000020.html" target="Code" class="method-signature"
326
- onclick="popupCode('Inflector.src/M000020.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-M000033" class="method-detail">
336
- <a name="M000033"></a>
337
-
338
- <div class="method-heading">
339
- <a href="Inflector.src/M000033.html" target="Code" class="method-signature"
340
- onclick="popupCode('Inflector.src/M000033.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-M000021" class="method-detail">
363
- <a name="M000021"></a>
364
-
365
- <div class="method-heading">
366
- <a href="Inflector.src/M000021.html" target="Code" class="method-signature"
367
- onclick="popupCode('Inflector.src/M000021.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-M000022" class="method-detail">
391
- <a name="M000022"></a>
392
-
393
- <div class="method-heading">
394
- <a href="Inflector.src/M000022.html" target="Code" class="method-signature"
395
- onclick="popupCode('Inflector.src/M000022.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#M000021">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-M000029" class="method-detail">
420
- <a name="M000029"></a>
421
-
422
- <div class="method-heading">
423
- <a href="Inflector.src/M000029.html" target="Code" class="method-signature"
424
- onclick="popupCode('Inflector.src/M000029.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#M000021">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-M000024" class="method-detail">
447
- <a name="M000024"></a>
448
-
449
- <div class="method-heading">
450
- <a href="Inflector.src/M000024.html" target="Code" class="method-signature"
451
- onclick="popupCode('Inflector.src/M000024.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#M000024">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-M000025" class="method-detail">
477
- <a name="M000025"></a>
478
-
479
- <div class="method-heading">
480
- <a href="Inflector.src/M000025.html" target="Code" class="method-signature"
481
- onclick="popupCode('Inflector.src/M000025.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#M000023">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>