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
data/LICENSE
CHANGED
data/README
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
== SimpleMapper
|
2
|
+
|
3
|
+
The purpose of this is to provide Ruby models with Persistence in the simplest way possible.
|
4
|
+
Like all ORM's it must be based on two components: Format and Connection. The aim is to stay out of the way
|
5
|
+
as much as possible: Format will be performed by calling, for example a Person class using the xml format:
|
6
|
+
'@person.to_xml', and likewise 'Person.from_xml'.
|
7
|
+
|
8
|
+
SimpleMapper will hold no concept of primary keys or even of properties or attributes. It will be data-agnostic.
|
9
|
+
It will simply handle the transformation and communication of data while providing a common method interface
|
10
|
+
in order to remove the model from the persistence.
|
11
|
+
|
12
|
+
The connection class will simply work with the idea of messages sent by adapters. All adapters must respond to these methods
|
13
|
+
appropriately: get, put, post, and delete. These correspond directly to HTTP methods, and correspond to SQL commands
|
14
|
+
in the order of SELECT, UPDATE, INSERT, and DELETE. It is up to an extraneous library/gem to handle conversions of special
|
15
|
+
"finder" options, like converting an options hash to a sql SELECT request, or mapping an options hash to an HTTP request.
|
16
|
+
It is purposed to make it as light and simple as possible to plug these in.
|
data/Rakefile
CHANGED
data/doc/classes/Array.html
CHANGED
@@ -55,6 +55,10 @@
|
|
55
55
|
<tr class="top-aligned-row">
|
56
56
|
<td><strong>In:</strong></td>
|
57
57
|
<td>
|
58
|
+
<a href="../files/lib/simple_mapper/default_plugins/options_to_query_rb.html">
|
59
|
+
lib/simple_mapper/default_plugins/options_to_query.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
58
62
|
<a href="../files/lib/simple_mapper/support/core_ext_rb.html">
|
59
63
|
lib/simple_mapper/support/core_ext.rb
|
60
64
|
</a>
|
@@ -88,7 +92,8 @@
|
|
88
92
|
<h3 class="section-bar">Methods</h3>
|
89
93
|
|
90
94
|
<div class="name-list">
|
91
|
-
<a href="#
|
95
|
+
<a href="#M000006">crawl</a>
|
96
|
+
<a href="#M000005">except</a>
|
92
97
|
</div>
|
93
98
|
</div>
|
94
99
|
|
@@ -110,12 +115,12 @@
|
|
110
115
|
<div id="methods">
|
111
116
|
<h3 class="section-bar">Public Instance methods</h3>
|
112
117
|
|
113
|
-
<div id="method-
|
114
|
-
<a name="
|
118
|
+
<div id="method-M000006" class="method-detail">
|
119
|
+
<a name="M000006"></a>
|
115
120
|
|
116
121
|
<div class="method-heading">
|
117
|
-
<a href="Array.src/
|
118
|
-
onclick="popupCode('Array.src/
|
122
|
+
<a href="Array.src/M000006.html" target="Code" class="method-signature"
|
123
|
+
onclick="popupCode('Array.src/M000006.html');return false;">
|
119
124
|
<span class="method-name">crawl</span><span class="method-args">() {|v| ...}</span>
|
120
125
|
</a>
|
121
126
|
</div>
|
@@ -124,6 +129,20 @@
|
|
124
129
|
</div>
|
125
130
|
</div>
|
126
131
|
|
132
|
+
<div id="method-M000005" class="method-detail">
|
133
|
+
<a name="M000005"></a>
|
134
|
+
|
135
|
+
<div class="method-heading">
|
136
|
+
<a href="Array.src/M000005.html" target="Code" class="method-signature"
|
137
|
+
onclick="popupCode('Array.src/M000005.html');return false;">
|
138
|
+
<span class="method-name">except</span><span class="method-args">(element)</span>
|
139
|
+
</a>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div class="method-description">
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
|
127
146
|
|
128
147
|
</div>
|
129
148
|
|
@@ -5,18 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>except (Array)</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/
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-
|
16
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-constant">Inflections</span>.<span class="ruby-identifier">instance</span>
|
17
|
-
<span class="ruby-keyword kw">else</span>
|
18
|
-
<span class="ruby-constant">Inflections</span>.<span class="ruby-identifier">instance</span>
|
19
|
-
<span class="ruby-keyword kw">end</span>
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/core_ext.rb, line 45</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">except</span>(<span class="ruby-identifier">element</span>)
|
15
|
+
<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">element</span>}
|
20
16
|
<span class="ruby-keyword kw">end</span></pre>
|
21
17
|
</body>
|
22
18
|
</html>
|
@@ -10,7 +10,7 @@
|
|
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/core_ext.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/core_ext.rb, line 49</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crawl</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
15
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"no block given"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>
|
16
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">v</span><span class="ruby-operator">|</span>
|
data/doc/classes/Callbacks.html
CHANGED
@@ -80,9 +80,9 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
85
|
-
<a href="#
|
83
|
+
<a href="#M000041">add_callback</a>
|
84
|
+
<a href="#M000040">callbacks</a>
|
85
|
+
<a href="#M000042">run_callback</a>
|
86
86
|
</div>
|
87
87
|
</div>
|
88
88
|
|
@@ -104,12 +104,12 @@
|
|
104
104
|
<div id="methods">
|
105
105
|
<h3 class="section-bar">Public Instance methods</h3>
|
106
106
|
|
107
|
-
<div id="method-
|
108
|
-
<a name="
|
107
|
+
<div id="method-M000041" class="method-detail">
|
108
|
+
<a name="M000041"></a>
|
109
109
|
|
110
110
|
<div class="method-heading">
|
111
|
-
<a href="Callbacks.src/
|
112
|
-
onclick="popupCode('Callbacks.src/
|
111
|
+
<a href="Callbacks.src/M000041.html" target="Code" class="method-signature"
|
112
|
+
onclick="popupCode('Callbacks.src/M000041.html');return false;">
|
113
113
|
<span class="method-name">add_callback</span><span class="method-args">(name,&block)</span>
|
114
114
|
</a>
|
115
115
|
</div>
|
@@ -118,12 +118,12 @@
|
|
118
118
|
</div>
|
119
119
|
</div>
|
120
120
|
|
121
|
-
<div id="method-
|
122
|
-
<a name="
|
121
|
+
<div id="method-M000040" class="method-detail">
|
122
|
+
<a name="M000040"></a>
|
123
123
|
|
124
124
|
<div class="method-heading">
|
125
|
-
<a href="Callbacks.src/
|
126
|
-
onclick="popupCode('Callbacks.src/
|
125
|
+
<a href="Callbacks.src/M000040.html" target="Code" class="method-signature"
|
126
|
+
onclick="popupCode('Callbacks.src/M000040.html');return false;">
|
127
127
|
<span class="method-name">callbacks</span><span class="method-args">()</span>
|
128
128
|
</a>
|
129
129
|
</div>
|
@@ -132,12 +132,12 @@
|
|
132
132
|
</div>
|
133
133
|
</div>
|
134
134
|
|
135
|
-
<div id="method-
|
136
|
-
<a name="
|
135
|
+
<div id="method-M000042" class="method-detail">
|
136
|
+
<a name="M000042"></a>
|
137
137
|
|
138
138
|
<div class="method-heading">
|
139
|
-
<a href="Callbacks.src/
|
140
|
-
onclick="popupCode('Callbacks.src/
|
139
|
+
<a href="Callbacks.src/M000042.html" target="Code" class="method-signature"
|
140
|
+
onclick="popupCode('Callbacks.src/M000042.html');return false;">
|
141
141
|
<span class="method-name">run_callback</span><span class="method-args">(name, *args)</span>
|
142
142
|
</a>
|
143
143
|
</div>
|
File without changes
|
File without changes
|
File without changes
|
data/doc/classes/Enumerable.html
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
83
|
+
<a href="#M000043">group_by</a>
|
84
84
|
</div>
|
85
85
|
</div>
|
86
86
|
|
@@ -102,12 +102,12 @@
|
|
102
102
|
<div id="methods">
|
103
103
|
<h3 class="section-bar">Public Instance methods</h3>
|
104
104
|
|
105
|
-
<div id="method-
|
106
|
-
<a name="
|
105
|
+
<div id="method-M000043" class="method-detail">
|
106
|
+
<a name="M000043"></a>
|
107
107
|
|
108
108
|
<div class="method-heading">
|
109
|
-
<a href="Enumerable.src/
|
110
|
-
onclick="popupCode('Enumerable.src/
|
109
|
+
<a href="Enumerable.src/M000043.html" target="Code" class="method-signature"
|
110
|
+
onclick="popupCode('Enumerable.src/M000043.html');return false;">
|
111
111
|
<span class="method-name">group_by</span><span class="method-args">() {|element| ...}</span>
|
112
112
|
</a>
|
113
113
|
</div>
|
@@ -10,7 +10,7 @@
|
|
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/core_ext.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/simple_mapper/support/core_ext.rb, line 71</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">group_by</span>
|
15
15
|
<span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">groups</span>, <span class="ruby-identifier">element</span><span class="ruby-operator">|</span>
|
16
16
|
(<span class="ruby-identifier">groups</span>[<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">element</span>)] <span class="ruby-operator">||=</span> []) <span class="ruby-operator"><<</span> <span class="ruby-identifier">element</span>
|
data/doc/classes/Hash.html
CHANGED
@@ -55,6 +55,10 @@
|
|
55
55
|
<tr class="top-aligned-row">
|
56
56
|
<td><strong>In:</strong></td>
|
57
57
|
<td>
|
58
|
+
<a href="../files/lib/simple_mapper/default_plugins/options_to_query_rb.html">
|
59
|
+
lib/simple_mapper/default_plugins/options_to_query.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
58
62
|
<a href="../files/lib/simple_mapper/support/core_ext_rb.html">
|
59
63
|
lib/simple_mapper/support/core_ext.rb
|
60
64
|
</a>
|
@@ -88,8 +92,9 @@
|
|
88
92
|
<h3 class="section-bar">Methods</h3>
|
89
93
|
|
90
94
|
<div class="name-list">
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
95
|
+
<a href="#M000004">crawl</a>
|
96
|
+
<a href="#M000003">stringify_keys!</a>
|
97
|
+
<a href="#M000002">to_query</a>
|
93
98
|
</div>
|
94
99
|
</div>
|
95
100
|
|
@@ -111,13 +116,27 @@
|
|
111
116
|
<div id="methods">
|
112
117
|
<h3 class="section-bar">Public Instance methods</h3>
|
113
118
|
|
119
|
+
<div id="method-M000004" class="method-detail">
|
120
|
+
<a name="M000004"></a>
|
121
|
+
|
122
|
+
<div class="method-heading">
|
123
|
+
<a href="Hash.src/M000004.html" target="Code" class="method-signature"
|
124
|
+
onclick="popupCode('Hash.src/M000004.html');return false;">
|
125
|
+
<span class="method-name">crawl</span><span class="method-args">() {|v| ...}</span>
|
126
|
+
</a>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div class="method-description">
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
|
114
133
|
<div id="method-M000003" class="method-detail">
|
115
134
|
<a name="M000003"></a>
|
116
135
|
|
117
136
|
<div class="method-heading">
|
118
137
|
<a href="Hash.src/M000003.html" target="Code" class="method-signature"
|
119
138
|
onclick="popupCode('Hash.src/M000003.html');return false;">
|
120
|
-
<span class="method-name">
|
139
|
+
<span class="method-name">stringify_keys!</span><span class="method-args">()</span>
|
121
140
|
</a>
|
122
141
|
</div>
|
123
142
|
|
@@ -131,7 +150,7 @@
|
|
131
150
|
<div class="method-heading">
|
132
151
|
<a href="Hash.src/M000002.html" target="Code" class="method-signature"
|
133
152
|
onclick="popupCode('Hash.src/M000002.html');return false;">
|
134
|
-
<span class="method-name">
|
153
|
+
<span class="method-name">to_query</span><span class="method-args">(namespace=nil)</span>
|
135
154
|
</a>
|
136
155
|
</div>
|
137
156
|
|
@@ -5,14 +5,16 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>to_query (Hash)</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/
|
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/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">"#{namespace}[#{key}]"</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">'&'</span>
|
16
18
|
<span class="ruby-keyword kw">end</span></pre>
|
17
19
|
</body>
|
18
20
|
</html>
|
@@ -5,30 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>stringify_keys! (Hash)</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/core_ext.rb, line
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
15
|
-
<span class="ruby-identifier">
|
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">&</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">&</span><span class="ruby-identifier">block</span>)
|
30
|
-
<span class="ruby-keyword kw">end</span>
|
31
|
-
<span class="ruby-keyword kw">end</span>
|
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>)}
|
32
16
|
<span class="ruby-keyword kw">end</span></pre>
|
33
17
|
</body>
|
34
18
|
</html>
|
@@ -0,0 +1,34 @@
|
|
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">&</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">"no block given"</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">&</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">&</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>
|
@@ -83,7 +83,7 @@
|
|
83
83
|
<div id="description">
|
84
84
|
<p>
|
85
85
|
A singleton instance of this class is yielded by <a
|
86
|
-
href="../Inflector.html#
|
86
|
+
href="../Inflector.html#M000020">Inflector.inflections</a>, which can then
|
87
87
|
be used to specify additional inflection rules. Examples:
|
88
88
|
</p>
|
89
89
|
<pre>
|
@@ -98,7 +98,7 @@ be used to specify additional inflection rules. Examples:
|
|
98
98
|
</pre>
|
99
99
|
<p>
|
100
100
|
New rules are added at the top. So in the example above, the <a
|
101
|
-
href="Inflections.html#
|
101
|
+
href="Inflections.html#M000037">irregular</a> rule for octopus will now be
|
102
102
|
the first of the pluralization and singularization rules that is runs. This
|
103
103
|
guarantees that your rules run before any of the rules that may already
|
104
104
|
have been loaded.
|
@@ -113,12 +113,12 @@ have been loaded.
|
|
113
113
|
<h3 class="section-bar">Methods</h3>
|
114
114
|
|
115
115
|
<div class="name-list">
|
116
|
-
<a href="#
|
117
|
-
<a href="#
|
118
|
-
<a href="#
|
119
|
-
<a href="#
|
120
|
-
<a href="#
|
121
|
-
<a href="#
|
116
|
+
<a href="#M000039">clear</a>
|
117
|
+
<a href="#M000037">irregular</a>
|
118
|
+
<a href="#M000034">new</a>
|
119
|
+
<a href="#M000035">plural</a>
|
120
|
+
<a href="#M000036">singular</a>
|
121
|
+
<a href="#M000038">uncountable</a>
|
122
122
|
</div>
|
123
123
|
</div>
|
124
124
|
|
@@ -170,12 +170,12 @@ have been loaded.
|
|
170
170
|
<div id="methods">
|
171
171
|
<h3 class="section-bar">Public Class methods</h3>
|
172
172
|
|
173
|
-
<div id="method-
|
174
|
-
<a name="
|
173
|
+
<div id="method-M000034" class="method-detail">
|
174
|
+
<a name="M000034"></a>
|
175
175
|
|
176
176
|
<div class="method-heading">
|
177
|
-
<a href="Inflections.src/
|
178
|
-
onclick="popupCode('Inflections.src/
|
177
|
+
<a href="Inflections.src/M000034.html" target="Code" class="method-signature"
|
178
|
+
onclick="popupCode('Inflections.src/M000034.html');return false;">
|
179
179
|
<span class="method-name">new</span><span class="method-args">()</span>
|
180
180
|
</a>
|
181
181
|
</div>
|
@@ -186,12 +186,12 @@ have been loaded.
|
|
186
186
|
|
187
187
|
<h3 class="section-bar">Public Instance methods</h3>
|
188
188
|
|
189
|
-
<div id="method-
|
190
|
-
<a name="
|
189
|
+
<div id="method-M000039" class="method-detail">
|
190
|
+
<a name="M000039"></a>
|
191
191
|
|
192
192
|
<div class="method-heading">
|
193
|
-
<a href="Inflections.src/
|
194
|
-
onclick="popupCode('Inflections.src/
|
193
|
+
<a href="Inflections.src/M000039.html" target="Code" class="method-signature"
|
194
|
+
onclick="popupCode('Inflections.src/M000039.html');return false;">
|
195
195
|
<span class="method-name">clear</span><span class="method-args">(scope = :all)</span>
|
196
196
|
</a>
|
197
197
|
</div>
|
@@ -212,25 +212,25 @@ Examples:
|
|
212
212
|
</div>
|
213
213
|
</div>
|
214
214
|
|
215
|
-
<div id="method-
|
216
|
-
<a name="
|
215
|
+
<div id="method-M000037" class="method-detail">
|
216
|
+
<a name="M000037"></a>
|
217
217
|
|
218
218
|
<div class="method-heading">
|
219
|
-
<a href="Inflections.src/
|
220
|
-
onclick="popupCode('Inflections.src/
|
219
|
+
<a href="Inflections.src/M000037.html" target="Code" class="method-signature"
|
220
|
+
onclick="popupCode('Inflections.src/M000037.html');return false;">
|
221
221
|
<span class="method-name">irregular</span><span class="method-args">(singular, plural)</span>
|
222
222
|
</a>
|
223
223
|
</div>
|
224
224
|
|
225
225
|
<div class="method-description">
|
226
226
|
<p>
|
227
|
-
Specifies a <a href="Inflections.html#
|
228
|
-
href="Inflections.html#
|
227
|
+
Specifies a <a href="Inflections.html#M000034">new</a> <a
|
228
|
+
href="Inflections.html#M000037">irregular</a> that applies to both
|
229
229
|
pluralization and singularization at the same time. This can only be used
|
230
230
|
for strings, not regular expressions. You simply pass the <a
|
231
|
-
href="Inflections.html#
|
232
|
-
href="Inflections.html#
|
233
|
-
href="Inflections.html#
|
231
|
+
href="Inflections.html#M000037">irregular</a> in <a
|
232
|
+
href="Inflections.html#M000036">singular</a> and <a
|
233
|
+
href="Inflections.html#M000035">plural</a> form.
|
234
234
|
</p>
|
235
235
|
<p>
|
236
236
|
Examples:
|
@@ -242,19 +242,19 @@ Examples:
|
|
242
242
|
</div>
|
243
243
|
</div>
|
244
244
|
|
245
|
-
<div id="method-
|
246
|
-
<a name="
|
245
|
+
<div id="method-M000035" class="method-detail">
|
246
|
+
<a name="M000035"></a>
|
247
247
|
|
248
248
|
<div class="method-heading">
|
249
|
-
<a href="Inflections.src/
|
250
|
-
onclick="popupCode('Inflections.src/
|
249
|
+
<a href="Inflections.src/M000035.html" target="Code" class="method-signature"
|
250
|
+
onclick="popupCode('Inflections.src/M000035.html');return false;">
|
251
251
|
<span class="method-name">plural</span><span class="method-args">(rule, replacement)</span>
|
252
252
|
</a>
|
253
253
|
</div>
|
254
254
|
|
255
255
|
<div class="method-description">
|
256
256
|
<p>
|
257
|
-
Specifies a <a href="Inflections.html#
|
257
|
+
Specifies a <a href="Inflections.html#M000034">new</a> pluralization rule
|
258
258
|
and its replacement. The rule can either be a string or a regular
|
259
259
|
expression. The replacement should always be a string that may include
|
260
260
|
references to the matched data from the rule.
|
@@ -262,19 +262,19 @@ references to the matched data from the rule.
|
|
262
262
|
</div>
|
263
263
|
</div>
|
264
264
|
|
265
|
-
<div id="method-
|
266
|
-
<a name="
|
265
|
+
<div id="method-M000036" class="method-detail">
|
266
|
+
<a name="M000036"></a>
|
267
267
|
|
268
268
|
<div class="method-heading">
|
269
|
-
<a href="Inflections.src/
|
270
|
-
onclick="popupCode('Inflections.src/
|
269
|
+
<a href="Inflections.src/M000036.html" target="Code" class="method-signature"
|
270
|
+
onclick="popupCode('Inflections.src/M000036.html');return false;">
|
271
271
|
<span class="method-name">singular</span><span class="method-args">(rule, replacement)</span>
|
272
272
|
</a>
|
273
273
|
</div>
|
274
274
|
|
275
275
|
<div class="method-description">
|
276
276
|
<p>
|
277
|
-
Specifies a <a href="Inflections.html#
|
277
|
+
Specifies a <a href="Inflections.html#M000034">new</a> singularization rule
|
278
278
|
and its replacement. The rule can either be a string or a regular
|
279
279
|
expression. The replacement should always be a string that may include
|
280
280
|
references to the matched data from the rule.
|
@@ -282,19 +282,19 @@ references to the matched data from the rule.
|
|
282
282
|
</div>
|
283
283
|
</div>
|
284
284
|
|
285
|
-
<div id="method-
|
286
|
-
<a name="
|
285
|
+
<div id="method-M000038" class="method-detail">
|
286
|
+
<a name="M000038"></a>
|
287
287
|
|
288
288
|
<div class="method-heading">
|
289
|
-
<a href="Inflections.src/
|
290
|
-
onclick="popupCode('Inflections.src/
|
289
|
+
<a href="Inflections.src/M000038.html" target="Code" class="method-signature"
|
290
|
+
onclick="popupCode('Inflections.src/M000038.html');return false;">
|
291
291
|
<span class="method-name">uncountable</span><span class="method-args">(*words)</span>
|
292
292
|
</a>
|
293
293
|
</div>
|
294
294
|
|
295
295
|
<div class="method-description">
|
296
296
|
<p>
|
297
|
-
Add <a href="Inflections.html#
|
297
|
+
Add <a href="Inflections.html#M000038">uncountable</a> words that
|
298
298
|
shouldn‘t be attempted inflected.
|
299
299
|
</p>
|
300
300
|
<p>
|
@@ -5,15 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>new (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-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>])
|
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> = [], [], []
|
17
16
|
<span class="ruby-keyword kw">end</span></pre>
|
18
17
|
</body>
|
19
18
|
</html>
|