simplemapper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README +16 -0
- data/Rakefile +1 -1
- data/doc/classes/Array.html +24 -5
- data/doc/classes/{Inflector.src/M000017.html → Array.src/M000005.html} +4 -8
- data/doc/classes/Array.src/{M000001.html → M000006.html} +1 -1
- data/doc/classes/Callbacks.html +15 -15
- data/doc/classes/Callbacks.src/{M000037.html → M000040.html} +0 -0
- data/doc/classes/Callbacks.src/{M000038.html → M000041.html} +0 -0
- data/doc/classes/Callbacks.src/{M000039.html → M000042.html} +0 -0
- data/doc/classes/Enumerable.html +5 -5
- data/doc/classes/Enumerable.src/{M000040.html → M000043.html} +1 -1
- data/doc/classes/Hash.html +23 -4
- data/doc/classes/Hash.src/M000002.html +6 -4
- data/doc/classes/Hash.src/M000003.html +4 -20
- data/doc/classes/Hash.src/M000004.html +34 -0
- data/doc/classes/Inflector/Inflections.html +40 -40
- data/doc/classes/Inflector/Inflections.src/M000034.html +4 -5
- data/doc/classes/Inflector/Inflections.src/M000035.html +4 -4
- data/doc/classes/Inflector/Inflections.src/M000036.html +4 -9
- data/doc/classes/Inflector/Inflections.src/M000037.html +19 -0
- data/doc/classes/Inflector/Inflections.src/{M000031.html → M000038.html} +4 -4
- data/doc/classes/Inflector/Inflections.src/M000039.html +23 -0
- data/doc/classes/Inflector.html +82 -82
- data/doc/classes/Inflector.src/M000020.html +6 -6
- data/doc/classes/Inflector.src/M000021.html +11 -4
- data/doc/classes/Inflector.src/M000022.html +11 -8
- data/doc/classes/Inflector.src/M000023.html +8 -4
- data/doc/classes/Inflector.src/M000024.html +4 -4
- data/doc/classes/Inflector.src/M000025.html +8 -4
- data/doc/classes/Inflector.src/M000026.html +4 -4
- data/doc/classes/Inflector.src/M000027.html +4 -5
- data/doc/classes/Inflector.src/M000028.html +4 -4
- data/doc/classes/Inflector.src/M000029.html +4 -8
- data/doc/classes/Inflector.src/M000030.html +5 -13
- data/doc/classes/Inflector.src/M000031.html +18 -0
- data/doc/classes/Inflector.src/M000032.html +22 -0
- data/doc/classes/Inflector.src/M000033.html +27 -0
- data/doc/classes/Merb/Request.html +5 -5
- data/doc/classes/Merb/Request.src/{M000041.html → M000044.html} +1 -1
- data/doc/classes/OAuth/RequestProxy/Base.html +5 -5
- data/doc/classes/OAuth/RequestProxy/Base.src/{M000012.html → M000015.html} +1 -1
- data/doc/classes/OAuth/Signature/Base.html +5 -5
- data/doc/classes/OAuth/Signature/Base.src/{M000011.html → M000014.html} +1 -1
- data/doc/classes/OAuthController.html +25 -25
- data/doc/classes/OAuthController.src/M000008.html +8 -11
- data/doc/classes/OAuthController.src/M000009.html +4 -5
- data/doc/classes/OAuthController.src/{M000007.html → M000010.html} +1 -1
- data/doc/classes/OAuthController.src/M000011.html +25 -0
- data/doc/classes/OAuthController.src/M000012.html +19 -0
- data/doc/classes/Object.html +18 -6
- data/doc/classes/Object.src/{M000010.html → M000013.html} +2 -2
- data/doc/classes/Proc.html +5 -5
- data/doc/classes/Proc.src/{M000004.html → M000007.html} +0 -0
- data/doc/classes/Serialize.html +20 -20
- data/doc/classes/Serialize.src/M000016.html +7 -32
- data/doc/classes/Serialize.src/{M000014.html → M000017.html} +1 -1
- data/doc/classes/Serialize.src/{M000015.html → M000018.html} +1 -1
- data/doc/classes/Serialize.src/M000019.html +18 -0
- data/doc/classes/SimpleMapper/Base.html +149 -124
- data/doc/classes/SimpleMapper/Base.src/M000067.html +3 -8
- data/doc/classes/SimpleMapper/Base.src/M000068.html +3 -13
- data/doc/classes/SimpleMapper/Base.src/M000069.html +4 -4
- data/doc/classes/SimpleMapper/Base.src/M000070.html +15 -4
- data/doc/classes/SimpleMapper/Base.src/M000071.html +7 -4
- data/doc/classes/SimpleMapper/Base.src/M000072.html +4 -5
- data/doc/classes/SimpleMapper/Base.src/M000073.html +12 -9
- data/doc/classes/SimpleMapper/Base.src/M000074.html +8 -5
- data/doc/classes/SimpleMapper/Base.src/M000075.html +5 -7
- data/doc/classes/SimpleMapper/Base.src/M000076.html +5 -5
- data/doc/classes/SimpleMapper/Base.src/M000077.html +6 -5
- data/doc/classes/SimpleMapper/Base.src/M000078.html +10 -6
- data/doc/classes/SimpleMapper/Base.src/M000079.html +4 -4
- data/doc/classes/SimpleMapper/Base.src/M000080.html +6 -4
- data/doc/classes/SimpleMapper/Base.src/M000081.html +4 -5
- data/doc/classes/SimpleMapper/Base.src/M000082.html +4 -6
- data/doc/classes/SimpleMapper/Base.src/M000083.html +5 -10
- data/doc/classes/SimpleMapper/Base.src/M000084.html +4 -4
- data/doc/classes/SimpleMapper/{HttpAdapter.src/M000057.html → Base.src/M000085.html} +4 -4
- data/doc/classes/SimpleMapper/Base.src/M000086.html +19 -0
- data/doc/classes/SimpleMapper/Base.src/M000087.html +20 -0
- data/doc/classes/SimpleMapper/Base.src/M000088.html +24 -0
- data/doc/classes/SimpleMapper/Base.src/M000089.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.html +40 -40
- data/doc/classes/SimpleMapper/HttpAdapter.src/{M000056.html → M000059.html} +1 -1
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000060.html +4 -4
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000061.html +5 -4
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000063.html +5 -4
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000064.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/{M000062.html → M000065.html} +1 -1
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000066.html +18 -0
- data/doc/classes/SimpleMapper/HttpOAuthExtension.html +22 -22
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000051.html +27 -4
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/{M000049.html → M000052.html} +1 -3
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/{M000050.html → M000053.html} +1 -1
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000054.html +24 -0
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.html +10 -10
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/{M000046.html → M000049.html} +0 -0
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/{M000047.html → M000050.html} +0 -0
- data/doc/classes/SimpleMapper/SimpleModel.html +20 -20
- data/doc/classes/SimpleMapper/SimpleModel.src/M000045.html +4 -10
- data/doc/classes/SimpleMapper/SimpleModel.src/{M000043.html → M000046.html} +0 -0
- data/doc/classes/SimpleMapper/SimpleModel.src/{M000044.html → M000047.html} +0 -0
- data/doc/classes/SimpleMapper/SimpleModel.src/M000048.html +24 -0
- data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.html +5 -5
- data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.src/{M000055.html → M000058.html} +5 -3
- data/doc/classes/SimpleMapper/XmlFormat.html +15 -15
- data/doc/classes/SimpleMapper/XmlFormat.src/{M000052.html → M000055.html} +1 -1
- data/doc/classes/SimpleMapper/XmlFormat.src/{M000053.html → M000056.html} +1 -1
- data/doc/classes/SimpleMapper/XmlFormat.src/{M000054.html → M000057.html} +4 -2
- data/doc/classes/Time.html +139 -0
- data/doc/classes/{OAuthController.src/M000006.html → Time.src/M000001.html} +4 -4
- data/doc/created.rid +1 -1
- data/doc/files/lib/simple_mapper/adapters/http_adapter_rb.html +2 -1
- data/doc/files/lib/simple_mapper/base_rb.html +1 -1
- data/doc/files/lib/simple_mapper/default_plugins/callbacks_rb.html +1 -1
- data/doc/files/lib/simple_mapper/default_plugins/oauth_rb.html +1 -7
- data/doc/files/lib/simple_mapper/default_plugins/options_to_query_rb.html +116 -0
- data/doc/files/lib/simple_mapper/default_plugins/simple_model_rb.html +1 -1
- data/doc/files/lib/simple_mapper/formats/xml_format_rb.html +3 -1
- data/doc/files/lib/simple_mapper/support/bliss_serializer_rb.html +2 -1
- data/doc/files/lib/simple_mapper/support/core_ext_rb.html +1 -1
- data/doc/files/lib/simple_mapper/support/inflections_rb.html +1 -1
- data/doc/files/lib/simple_mapper/support/inflector_rb.html +1 -1
- data/doc/files/lib/simple_mapper/support_rb.html +1 -1
- data/doc/files/lib/simple_mapper_rb.html +1 -1
- data/doc/fr_class_index.html +1 -0
- data/doc/fr_file_index.html +1 -0
- data/doc/fr_method_index.html +89 -84
- data/lib/simple_mapper/adapters/http_adapter.rb +4 -2
- data/lib/simple_mapper/base.rb +46 -23
- data/lib/simple_mapper/default_plugins/oauth.rb +3 -6
- data/lib/simple_mapper/default_plugins/options_to_query.rb +31 -0
- data/lib/simple_mapper/formats/xml_format.rb +10 -3
- data/lib/simple_mapper/support/bliss_serializer.rb +3 -113
- data/lib/simple_mapper/support/core_ext.rb +6 -2
- data/lib/simple_mapper/support/inflections.rb +1 -1
- metadata +52 -43
- data/doc/classes/Inflector/Inflections.src/M000032.html +0 -18
- data/doc/classes/Inflector/Inflections.src/M000033.html +0 -18
- data/doc/classes/Inflector.src/M000018.html +0 -25
- data/doc/classes/Inflector.src/M000019.html +0 -25
- data/doc/classes/OAuthController.src/M000005.html +0 -22
- data/doc/classes/Serialize.src/M000013.html +0 -21
- data/doc/classes/SimpleMapper/Base.src/M000064.html +0 -16
- data/doc/classes/SimpleMapper/Base.src/M000065.html +0 -16
- data/doc/classes/SimpleMapper/Base.src/M000066.html +0 -22
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000058.html +0 -19
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000048.html +0 -49
- data/doc/classes/SimpleMapper/SimpleModel.src/M000042.html +0 -18
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>plural (Inflector::Inflections)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
|
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
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -5,19 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>singular (Inflector::Inflections)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-
|
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">"@#{scope}"</span>, []
|
20
|
-
<span class="ruby-keyword kw">end</span>
|
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>])
|
21
16
|
<span class="ruby-keyword kw">end</span></pre>
|
22
17
|
</body>
|
23
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">"(#{singular[0,1]})#{singular[1..-1]}$"</span>, <span class="ruby-value str">"i"</span>), <span class="ruby-value str">'\1'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">plural</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
16
|
+
<span class="ruby-identifier">singular</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"(#{plural[0,1]})#{plural[1..-1]}$"</span>, <span class="ruby-value str">"i"</span>), <span class="ruby-value str">'\1'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">singular</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>uncountable (Inflector::Inflections)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-ivar">@
|
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"><<</span> <span class="ruby-identifier">words</span>).<span class="ruby-identifier">flatten!</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
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">"@#{scope}"</span>, []
|
20
|
+
<span class="ruby-keyword kw">end</span>
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
22
|
+
</body>
|
23
|
+
</html>
|
data/doc/classes/Inflector.html
CHANGED
@@ -77,7 +77,7 @@
|
|
77
77
|
The <a href="Inflector.html">Inflector</a> transforms words from singular
|
78
78
|
to plural, class names to table names, modularized class names to ones
|
79
79
|
without, and class names to foreign keys. The default <a
|
80
|
-
href="Inflector.html#
|
80
|
+
href="Inflector.html#M000020">inflections</a> for pluralization,
|
81
81
|
singularization, and uncountable words are kept in inflections.rb.
|
82
82
|
</p>
|
83
83
|
|
@@ -90,20 +90,20 @@ singularization, and uncountable words are kept in inflections.rb.
|
|
90
90
|
<h3 class="section-bar">Methods</h3>
|
91
91
|
|
92
92
|
<div class="name-list">
|
93
|
-
<a href="#
|
94
|
-
<a href="#
|
95
|
-
<a href="#
|
96
|
-
<a href="#
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
106
|
-
<a href="#
|
93
|
+
<a href="#M000023">camelize</a>
|
94
|
+
<a href="#M000030">classify</a>
|
95
|
+
<a href="#M000032">constantize</a>
|
96
|
+
<a href="#M000026">dasherize</a>
|
97
|
+
<a href="#M000028">demodulize</a>
|
98
|
+
<a href="#M000031">foreign_key</a>
|
99
|
+
<a href="#M000027">humanize</a>
|
100
|
+
<a href="#M000020">inflections</a>
|
101
|
+
<a href="#M000033">ordinalize</a>
|
102
|
+
<a href="#M000021">pluralize</a>
|
103
|
+
<a href="#M000022">singularize</a>
|
104
|
+
<a href="#M000029">tableize</a>
|
105
|
+
<a href="#M000024">titleize</a>
|
106
|
+
<a href="#M000025">underscore</a>
|
107
107
|
</div>
|
108
108
|
</div>
|
109
109
|
|
@@ -131,25 +131,25 @@ singularization, and uncountable words are kept in inflections.rb.
|
|
131
131
|
<div id="methods">
|
132
132
|
<h3 class="section-bar">Public Instance methods</h3>
|
133
133
|
|
134
|
-
<div id="method-
|
135
|
-
<a name="
|
134
|
+
<div id="method-M000023" class="method-detail">
|
135
|
+
<a name="M000023"></a>
|
136
136
|
|
137
137
|
<div class="method-heading">
|
138
|
-
<a href="Inflector.src/
|
139
|
-
onclick="popupCode('Inflector.src/
|
138
|
+
<a href="Inflector.src/M000023.html" target="Code" class="method-signature"
|
139
|
+
onclick="popupCode('Inflector.src/M000023.html');return false;">
|
140
140
|
<span class="method-name">camelize</span><span class="method-args">(lower_case_and_underscored_word, first_letter_in_uppercase = true)</span>
|
141
141
|
</a>
|
142
142
|
</div>
|
143
143
|
|
144
144
|
<div class="method-description">
|
145
145
|
<p>
|
146
|
-
By default, <a href="Inflector.html#
|
146
|
+
By default, <a href="Inflector.html#M000023">camelize</a> converts strings
|
147
147
|
to UpperCamelCase. If the argument to <a
|
148
|
-
href="Inflector.html#
|
149
|
-
then <a href="Inflector.html#
|
148
|
+
href="Inflector.html#M000023">camelize</a> is set to ":lower"
|
149
|
+
then <a href="Inflector.html#M000023">camelize</a> produces lowerCamelCase.
|
150
150
|
</p>
|
151
151
|
<p>
|
152
|
-
<a href="Inflector.html#
|
152
|
+
<a href="Inflector.html#M000023">camelize</a> will also convert
|
153
153
|
’/’ to ’::’ which is useful for converting paths to
|
154
154
|
namespaces
|
155
155
|
</p>
|
@@ -165,12 +165,12 @@ Examples
|
|
165
165
|
</div>
|
166
166
|
</div>
|
167
167
|
|
168
|
-
<div id="method-
|
169
|
-
<a name="
|
168
|
+
<div id="method-M000030" class="method-detail">
|
169
|
+
<a name="M000030"></a>
|
170
170
|
|
171
171
|
<div class="method-heading">
|
172
|
-
<a href="Inflector.src/
|
173
|
-
onclick="popupCode('Inflector.src/
|
172
|
+
<a href="Inflector.src/M000030.html" target="Code" class="method-signature"
|
173
|
+
onclick="popupCode('Inflector.src/M000030.html');return false;">
|
174
174
|
<span class="method-name">classify</span><span class="method-args">(table_name)</span>
|
175
175
|
</a>
|
176
176
|
</div>
|
@@ -179,8 +179,8 @@ Examples
|
|
179
179
|
<p>
|
180
180
|
Create a class name from a table name like Rails does for table names to
|
181
181
|
models. Note that this returns a string and not a Class. (To convert to an
|
182
|
-
actual class follow <a href="Inflector.html#
|
183
|
-
href="Inflector.html#
|
182
|
+
actual class follow <a href="Inflector.html#M000030">classify</a> with <a
|
183
|
+
href="Inflector.html#M000032">constantize</a>.)
|
184
184
|
</p>
|
185
185
|
<p>
|
186
186
|
Examples
|
@@ -192,12 +192,12 @@ Examples
|
|
192
192
|
</div>
|
193
193
|
</div>
|
194
194
|
|
195
|
-
<div id="method-
|
196
|
-
<a name="
|
195
|
+
<div id="method-M000032" class="method-detail">
|
196
|
+
<a name="M000032"></a>
|
197
197
|
|
198
198
|
<div class="method-heading">
|
199
|
-
<a href="Inflector.src/
|
200
|
-
onclick="popupCode('Inflector.src/
|
199
|
+
<a href="Inflector.src/M000032.html" target="Code" class="method-signature"
|
200
|
+
onclick="popupCode('Inflector.src/M000032.html');return false;">
|
201
201
|
<span class="method-name">constantize</span><span class="method-args">(camel_cased_word)</span>
|
202
202
|
</a>
|
203
203
|
</div>
|
@@ -218,12 +218,12 @@ Examples
|
|
218
218
|
</div>
|
219
219
|
</div>
|
220
220
|
|
221
|
-
<div id="method-
|
222
|
-
<a name="
|
221
|
+
<div id="method-M000026" class="method-detail">
|
222
|
+
<a name="M000026"></a>
|
223
223
|
|
224
224
|
<div class="method-heading">
|
225
|
-
<a href="Inflector.src/
|
226
|
-
onclick="popupCode('Inflector.src/
|
225
|
+
<a href="Inflector.src/M000026.html" target="Code" class="method-signature"
|
226
|
+
onclick="popupCode('Inflector.src/M000026.html');return false;">
|
227
227
|
<span class="method-name">dasherize</span><span class="method-args">(underscored_word)</span>
|
228
228
|
</a>
|
229
229
|
</div>
|
@@ -241,12 +241,12 @@ Example
|
|
241
241
|
</div>
|
242
242
|
</div>
|
243
243
|
|
244
|
-
<div id="method-
|
245
|
-
<a name="
|
244
|
+
<div id="method-M000028" class="method-detail">
|
245
|
+
<a name="M000028"></a>
|
246
246
|
|
247
247
|
<div class="method-heading">
|
248
|
-
<a href="Inflector.src/
|
249
|
-
onclick="popupCode('Inflector.src/
|
248
|
+
<a href="Inflector.src/M000028.html" target="Code" class="method-signature"
|
249
|
+
onclick="popupCode('Inflector.src/M000028.html');return false;">
|
250
250
|
<span class="method-name">demodulize</span><span class="method-args">(class_name_in_module)</span>
|
251
251
|
</a>
|
252
252
|
</div>
|
@@ -265,12 +265,12 @@ Examples
|
|
265
265
|
</div>
|
266
266
|
</div>
|
267
267
|
|
268
|
-
<div id="method-
|
269
|
-
<a name="
|
268
|
+
<div id="method-M000031" class="method-detail">
|
269
|
+
<a name="M000031"></a>
|
270
270
|
|
271
271
|
<div class="method-heading">
|
272
|
-
<a href="Inflector.src/
|
273
|
-
onclick="popupCode('Inflector.src/
|
272
|
+
<a href="Inflector.src/M000031.html" target="Code" class="method-signature"
|
273
|
+
onclick="popupCode('Inflector.src/M000031.html');return false;">
|
274
274
|
<span class="method-name">foreign_key</span><span class="method-args">(class_name, separate_class_name_and_id_with_underscore = true)</span>
|
275
275
|
</a>
|
276
276
|
</div>
|
@@ -292,12 +292,12 @@ Examples
|
|
292
292
|
</div>
|
293
293
|
</div>
|
294
294
|
|
295
|
-
<div id="method-
|
296
|
-
<a name="
|
295
|
+
<div id="method-M000027" class="method-detail">
|
296
|
+
<a name="M000027"></a>
|
297
297
|
|
298
298
|
<div class="method-heading">
|
299
|
-
<a href="Inflector.src/
|
300
|
-
onclick="popupCode('Inflector.src/
|
299
|
+
<a href="Inflector.src/M000027.html" target="Code" class="method-signature"
|
300
|
+
onclick="popupCode('Inflector.src/M000027.html');return false;">
|
301
301
|
<span class="method-name">humanize</span><span class="method-args">(lower_case_and_underscored_word)</span>
|
302
302
|
</a>
|
303
303
|
</div>
|
@@ -305,7 +305,7 @@ Examples
|
|
305
305
|
<div class="method-description">
|
306
306
|
<p>
|
307
307
|
Capitalizes the first word and turns underscores into spaces and strips
|
308
|
-
_id. Like <a href="Inflector.html#
|
308
|
+
_id. Like <a href="Inflector.html#M000024">titleize</a>, this is meant for
|
309
309
|
creating pretty output.
|
310
310
|
</p>
|
311
311
|
<p>
|
@@ -318,12 +318,12 @@ Examples
|
|
318
318
|
</div>
|
319
319
|
</div>
|
320
320
|
|
321
|
-
<div id="method-
|
322
|
-
<a name="
|
321
|
+
<div id="method-M000020" class="method-detail">
|
322
|
+
<a name="M000020"></a>
|
323
323
|
|
324
324
|
<div class="method-heading">
|
325
|
-
<a href="Inflector.src/
|
326
|
-
onclick="popupCode('Inflector.src/
|
325
|
+
<a href="Inflector.src/M000020.html" target="Code" class="method-signature"
|
326
|
+
onclick="popupCode('Inflector.src/M000020.html');return false;">
|
327
327
|
<span class="method-name">inflections</span><span class="method-args">() {|Inflections.instance| ...}</span>
|
328
328
|
</a>
|
329
329
|
</div>
|
@@ -332,12 +332,12 @@ Examples
|
|
332
332
|
</div>
|
333
333
|
</div>
|
334
334
|
|
335
|
-
<div id="method-
|
336
|
-
<a name="
|
335
|
+
<div id="method-M000033" class="method-detail">
|
336
|
+
<a name="M000033"></a>
|
337
337
|
|
338
338
|
<div class="method-heading">
|
339
|
-
<a href="Inflector.src/
|
340
|
-
onclick="popupCode('Inflector.src/
|
339
|
+
<a href="Inflector.src/M000033.html" target="Code" class="method-signature"
|
340
|
+
onclick="popupCode('Inflector.src/M000033.html');return false;">
|
341
341
|
<span class="method-name">ordinalize</span><span class="method-args">(number)</span>
|
342
342
|
</a>
|
343
343
|
</div>
|
@@ -359,12 +359,12 @@ Examples
|
|
359
359
|
</div>
|
360
360
|
</div>
|
361
361
|
|
362
|
-
<div id="method-
|
363
|
-
<a name="
|
362
|
+
<div id="method-M000021" class="method-detail">
|
363
|
+
<a name="M000021"></a>
|
364
364
|
|
365
365
|
<div class="method-heading">
|
366
|
-
<a href="Inflector.src/
|
367
|
-
onclick="popupCode('Inflector.src/
|
366
|
+
<a href="Inflector.src/M000021.html" target="Code" class="method-signature"
|
367
|
+
onclick="popupCode('Inflector.src/M000021.html');return false;">
|
368
368
|
<span class="method-name">pluralize</span><span class="method-args">(word)</span>
|
369
369
|
</a>
|
370
370
|
</div>
|
@@ -387,19 +387,19 @@ Examples
|
|
387
387
|
</div>
|
388
388
|
</div>
|
389
389
|
|
390
|
-
<div id="method-
|
391
|
-
<a name="
|
390
|
+
<div id="method-M000022" class="method-detail">
|
391
|
+
<a name="M000022"></a>
|
392
392
|
|
393
393
|
<div class="method-heading">
|
394
|
-
<a href="Inflector.src/
|
395
|
-
onclick="popupCode('Inflector.src/
|
394
|
+
<a href="Inflector.src/M000022.html" target="Code" class="method-signature"
|
395
|
+
onclick="popupCode('Inflector.src/M000022.html');return false;">
|
396
396
|
<span class="method-name">singularize</span><span class="method-args">(word)</span>
|
397
397
|
</a>
|
398
398
|
</div>
|
399
399
|
|
400
400
|
<div class="method-description">
|
401
401
|
<p>
|
402
|
-
The reverse of <a href="Inflector.html#
|
402
|
+
The reverse of <a href="Inflector.html#M000021">pluralize</a>, returns the
|
403
403
|
singular form of a word in a string.
|
404
404
|
</p>
|
405
405
|
<p>
|
@@ -416,12 +416,12 @@ Examples
|
|
416
416
|
</div>
|
417
417
|
</div>
|
418
418
|
|
419
|
-
<div id="method-
|
420
|
-
<a name="
|
419
|
+
<div id="method-M000029" class="method-detail">
|
420
|
+
<a name="M000029"></a>
|
421
421
|
|
422
422
|
<div class="method-heading">
|
423
|
-
<a href="Inflector.src/
|
424
|
-
onclick="popupCode('Inflector.src/
|
423
|
+
<a href="Inflector.src/M000029.html" target="Code" class="method-signature"
|
424
|
+
onclick="popupCode('Inflector.src/M000029.html');return false;">
|
425
425
|
<span class="method-name">tableize</span><span class="method-args">(class_name)</span>
|
426
426
|
</a>
|
427
427
|
</div>
|
@@ -429,7 +429,7 @@ Examples
|
|
429
429
|
<div class="method-description">
|
430
430
|
<p>
|
431
431
|
Create the name of a table like Rails does for models to table names. This
|
432
|
-
method uses the <a href="Inflector.html#
|
432
|
+
method uses the <a href="Inflector.html#M000021">pluralize</a> method on
|
433
433
|
the last word in the string.
|
434
434
|
</p>
|
435
435
|
<p>
|
@@ -443,12 +443,12 @@ Examples
|
|
443
443
|
</div>
|
444
444
|
</div>
|
445
445
|
|
446
|
-
<div id="method-
|
447
|
-
<a name="
|
446
|
+
<div id="method-M000024" class="method-detail">
|
447
|
+
<a name="M000024"></a>
|
448
448
|
|
449
449
|
<div class="method-heading">
|
450
|
-
<a href="Inflector.src/
|
451
|
-
onclick="popupCode('Inflector.src/
|
450
|
+
<a href="Inflector.src/M000024.html" target="Code" class="method-signature"
|
451
|
+
onclick="popupCode('Inflector.src/M000024.html');return false;">
|
452
452
|
<span class="method-name">titleize</span><span class="method-args">(word)</span>
|
453
453
|
</a>
|
454
454
|
</div>
|
@@ -460,7 +460,7 @@ create a nicer looking title. Titleize is meant for creating pretty output.
|
|
460
460
|
It is not used in the Rails internals.
|
461
461
|
</p>
|
462
462
|
<p>
|
463
|
-
<a href="Inflector.html#
|
463
|
+
<a href="Inflector.html#M000024">titleize</a> is also aliased as as
|
464
464
|
titlecase
|
465
465
|
</p>
|
466
466
|
<p>
|
@@ -473,19 +473,19 @@ Examples
|
|
473
473
|
</div>
|
474
474
|
</div>
|
475
475
|
|
476
|
-
<div id="method-
|
477
|
-
<a name="
|
476
|
+
<div id="method-M000025" class="method-detail">
|
477
|
+
<a name="M000025"></a>
|
478
478
|
|
479
479
|
<div class="method-heading">
|
480
|
-
<a href="Inflector.src/
|
481
|
-
onclick="popupCode('Inflector.src/
|
480
|
+
<a href="Inflector.src/M000025.html" target="Code" class="method-signature"
|
481
|
+
onclick="popupCode('Inflector.src/M000025.html');return false;">
|
482
482
|
<span class="method-name">underscore</span><span class="method-args">(camel_cased_word)</span>
|
483
483
|
</a>
|
484
484
|
</div>
|
485
485
|
|
486
486
|
<div class="method-description">
|
487
487
|
<p>
|
488
|
-
The reverse of <tt><a href="Inflector.html#
|
488
|
+
The reverse of <tt><a href="Inflector.html#M000023">camelize</a></tt>.
|
489
489
|
Makes an underscored form from the expression in the string.
|
490
490
|
</p>
|
491
491
|
<p>
|
@@ -5,17 +5,17 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>inflections (Inflector)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">
|
16
|
-
<span class="ruby-
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line 82</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
17
|
<span class="ruby-keyword kw">else</span>
|
18
|
-
<span class="ruby-
|
18
|
+
<span class="ruby-constant">Inflections</span>.<span class="ruby-identifier">instance</span>
|
19
19
|
<span class="ruby-keyword kw">end</span>
|
20
20
|
<span class="ruby-keyword kw">end</span></pre>
|
21
21
|
</body>
|
@@ -5,14 +5,21 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>pluralize (Inflector)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-identifier">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line 99</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">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>
|
16
23
|
<span class="ruby-keyword kw">end</span></pre>
|
17
24
|
</body>
|
18
25
|
</html>
|
@@ -5,18 +5,21 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>singularize (Inflector)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-identifier">
|
16
|
-
|
17
|
-
|
18
|
-
<span class="ruby-identifier">
|
19
|
-
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line 119</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>
|
20
23
|
<span class="ruby-keyword kw">end</span></pre>
|
21
24
|
</body>
|
22
25
|
</html>
|
@@ -5,14 +5,18 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>camelize (Inflector)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line 140</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">"::"</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>
|
16
20
|
<span class="ruby-keyword kw">end</span></pre>
|
17
21
|
</body>
|
18
22
|
</html>
|
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>titleize (Inflector)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-identifier">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/inflector.rb, line 157</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
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|