simplemapper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +16 -0
- data/README +0 -0
- data/Rakefile +78 -0
- data/doc/classes/Array.html +139 -0
- data/doc/classes/Array.src/M000001.html +34 -0
- data/doc/classes/Callbacks.html +161 -0
- data/doc/classes/Callbacks.src/M000037.html +18 -0
- data/doc/classes/Callbacks.src/M000038.html +18 -0
- data/doc/classes/Callbacks.src/M000039.html +19 -0
- data/doc/classes/Enumerable.html +131 -0
- data/doc/classes/Enumerable.src/M000040.html +21 -0
- data/doc/classes/Hash.html +154 -0
- data/doc/classes/Hash.src/M000002.html +18 -0
- data/doc/classes/Hash.src/M000003.html +34 -0
- data/doc/classes/Inflector/Inflections.html +323 -0
- data/doc/classes/Inflector/Inflections.src/M000031.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000032.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000033.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000034.html +19 -0
- data/doc/classes/Inflector/Inflections.src/M000035.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000036.html +23 -0
- data/doc/classes/Inflector.html +516 -0
- data/doc/classes/Inflector.src/M000017.html +22 -0
- data/doc/classes/Inflector.src/M000018.html +25 -0
- data/doc/classes/Inflector.src/M000019.html +25 -0
- data/doc/classes/Inflector.src/M000020.html +22 -0
- data/doc/classes/Inflector.src/M000021.html +18 -0
- data/doc/classes/Inflector.src/M000022.html +22 -0
- data/doc/classes/Inflector.src/M000023.html +18 -0
- data/doc/classes/Inflector.src/M000024.html +18 -0
- data/doc/classes/Inflector.src/M000025.html +18 -0
- data/doc/classes/Inflector.src/M000026.html +18 -0
- data/doc/classes/Inflector.src/M000027.html +19 -0
- data/doc/classes/Inflector.src/M000028.html +18 -0
- data/doc/classes/Inflector.src/M000029.html +22 -0
- data/doc/classes/Inflector.src/M000030.html +27 -0
- data/doc/classes/Merb/Request.html +139 -0
- data/doc/classes/Merb/Request.src/M000041.html +22 -0
- data/doc/classes/Merb.html +111 -0
- data/doc/classes/OAuth/RequestProxy/Base.html +139 -0
- data/doc/classes/OAuth/RequestProxy/Base.src/M000012.html +18 -0
- data/doc/classes/OAuth/RequestProxy.html +111 -0
- data/doc/classes/OAuth/Signature/Base.html +139 -0
- data/doc/classes/OAuth/Signature/Base.src/M000011.html +25 -0
- data/doc/classes/OAuth/Signature.html +111 -0
- data/doc/classes/OAuth.html +112 -0
- data/doc/classes/OAuthController.html +243 -0
- data/doc/classes/OAuthController.src/M000005.html +22 -0
- data/doc/classes/OAuthController.src/M000006.html +18 -0
- data/doc/classes/OAuthController.src/M000007.html +18 -0
- data/doc/classes/OAuthController.src/M000008.html +25 -0
- data/doc/classes/OAuthController.src/M000009.html +19 -0
- data/doc/classes/Object.html +142 -0
- data/doc/classes/Object.src/M000010.html +19 -0
- data/doc/classes/Proc.html +143 -0
- data/doc/classes/Proc.src/M000004.html +18 -0
- data/doc/classes/Serialize.html +189 -0
- data/doc/classes/Serialize.src/M000013.html +21 -0
- data/doc/classes/Serialize.src/M000014.html +39 -0
- data/doc/classes/Serialize.src/M000015.html +16 -0
- data/doc/classes/Serialize.src/M000016.html +46 -0
- data/doc/classes/SimpleMapper/Base.html +528 -0
- data/doc/classes/SimpleMapper/Base.src/M000064.html +16 -0
- data/doc/classes/SimpleMapper/Base.src/M000065.html +16 -0
- data/doc/classes/SimpleMapper/Base.src/M000066.html +22 -0
- data/doc/classes/SimpleMapper/Base.src/M000067.html +21 -0
- data/doc/classes/SimpleMapper/Base.src/M000068.html +26 -0
- data/doc/classes/SimpleMapper/Base.src/M000069.html +18 -0
- data/doc/classes/SimpleMapper/Base.src/M000070.html +18 -0
- data/doc/classes/SimpleMapper/Base.src/M000071.html +18 -0
- data/doc/classes/SimpleMapper/Base.src/M000072.html +19 -0
- data/doc/classes/SimpleMapper/Base.src/M000073.html +23 -0
- data/doc/classes/SimpleMapper/Base.src/M000074.html +18 -0
- data/doc/classes/SimpleMapper/Base.src/M000075.html +20 -0
- data/doc/classes/SimpleMapper/Base.src/M000076.html +18 -0
- data/doc/classes/SimpleMapper/Base.src/M000077.html +18 -0
- data/doc/classes/SimpleMapper/Base.src/M000078.html +19 -0
- data/doc/classes/SimpleMapper/Base.src/M000079.html +18 -0
- data/doc/classes/SimpleMapper/Base.src/M000080.html +18 -0
- data/doc/classes/SimpleMapper/Base.src/M000081.html +19 -0
- data/doc/classes/SimpleMapper/Base.src/M000082.html +20 -0
- data/doc/classes/SimpleMapper/Base.src/M000083.html +24 -0
- data/doc/classes/SimpleMapper/Base.src/M000084.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.html +280 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000056.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000057.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000058.html +19 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000060.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000061.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000062.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000063.html +18 -0
- data/doc/classes/SimpleMapper/HttpOAuthExtension.html +188 -0
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000048.html +49 -0
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000049.html +23 -0
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000050.html +18 -0
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000051.html +24 -0
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.html +146 -0
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/M000046.html +19 -0
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/M000047.html +19 -0
- data/doc/classes/SimpleMapper/SimpleModel.html +184 -0
- data/doc/classes/SimpleMapper/SimpleModel.src/M000042.html +18 -0
- data/doc/classes/SimpleMapper/SimpleModel.src/M000043.html +18 -0
- data/doc/classes/SimpleMapper/SimpleModel.src/M000044.html +18 -0
- data/doc/classes/SimpleMapper/SimpleModel.src/M000045.html +24 -0
- data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.html +152 -0
- data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.src/M000055.html +30 -0
- data/doc/classes/SimpleMapper/XmlFormat.html +169 -0
- data/doc/classes/SimpleMapper/XmlFormat.src/M000052.html +18 -0
- data/doc/classes/SimpleMapper/XmlFormat.src/M000053.html +18 -0
- data/doc/classes/SimpleMapper/XmlFormat.src/M000054.html +18 -0
- data/doc/classes/SimpleMapper.html +146 -0
- data/doc/classes/String.html +120 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/simple_mapper/adapters/http_adapter_rb.html +110 -0
- data/doc/files/lib/simple_mapper/base_rb.html +108 -0
- data/doc/files/lib/simple_mapper/default_plugins/callbacks_rb.html +101 -0
- data/doc/files/lib/simple_mapper/default_plugins/oauth_rb.html +116 -0
- data/doc/files/lib/simple_mapper/default_plugins/simple_model_rb.html +101 -0
- data/doc/files/lib/simple_mapper/formats/xml_format_rb.html +108 -0
- data/doc/files/lib/simple_mapper/support/bliss_serializer_rb.html +109 -0
- data/doc/files/lib/simple_mapper/support/core_ext_rb.html +108 -0
- data/doc/files/lib/simple_mapper/support/inflections_rb.html +101 -0
- data/doc/files/lib/simple_mapper/support/inflector_rb.html +108 -0
- data/doc/files/lib/simple_mapper/support_rb.html +109 -0
- data/doc/files/lib/simple_mapper_rb.html +137 -0
- data/doc/fr_class_index.html +52 -0
- data/doc/fr_file_index.html +38 -0
- data/doc/fr_method_index.html +110 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/simple_mapper/adapters/http_adapter.rb +64 -0
- data/lib/simple_mapper/base.rb +138 -0
- data/lib/simple_mapper/default_plugins/callbacks.rb +12 -0
- data/lib/simple_mapper/default_plugins/oauth.rb +167 -0
- data/lib/simple_mapper/default_plugins/simple_model.rb +36 -0
- data/lib/simple_mapper/formats/xml_format.rb +48 -0
- data/lib/simple_mapper/support/bliss_serializer.rb +168 -0
- data/lib/simple_mapper/support/core_ext.rb +73 -0
- data/lib/simple_mapper/support/inflections.rb +112 -0
- data/lib/simple_mapper/support/inflector.rb +275 -0
- data/lib/simple_mapper/support.rb +2 -0
- data/lib/simple_mapper.rb +16 -0
- metadata +236 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>included (SimpleMapper::SimpleModel)</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/simple_model.rb, line 3</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
|
15
|
+
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>to_hash (SimpleMapper::SimpleModel)</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/simple_model.rb, line 7</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>(<span class="ruby-identifier">options</span>={})
|
15
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">inject</span>({}) {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">"@#{k}"</span>); <span class="ruby-identifier">h</span>}
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>identifier (SimpleMapper::SimpleModel)</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/simple_model.rb, line 11</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">identifier</span>
|
15
|
+
<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@'</span><span class="ruby-operator">+</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">identifier</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
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>method_missing (SimpleMapper::SimpleModel)</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/simple_model.rb, line 15</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">method</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>)
|
16
|
+
<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@'</span><span class="ruby-operator">+</span><span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>)
|
17
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/=$/</span> <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">method</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>))
|
18
|
+
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">'@'</span><span class="ruby-operator">+</span><span class="ruby-identifier">method</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">args</span>)
|
19
|
+
<span class="ruby-keyword kw">else</span>
|
20
|
+
<span class="ruby-keyword kw">super</span>
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
23
|
+
</body>
|
24
|
+
</html>
|
@@ -0,0 +1,152 @@
|
|
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: SimpleMapper::XmlFormat::ClassMethods</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">SimpleMapper::XmlFormat::ClassMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/simple_mapper/formats/xml_format_rb.html">
|
59
|
+
lib/simple_mapper/formats/xml_format.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
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000055">from_xml</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
<div id="methods">
|
103
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
104
|
+
|
105
|
+
<div id="method-M000055" class="method-detail">
|
106
|
+
<a name="M000055"></a>
|
107
|
+
|
108
|
+
<div class="method-heading">
|
109
|
+
<a href="ClassMethods.src/M000055.html" target="Code" class="method-signature"
|
110
|
+
onclick="popupCode('ClassMethods.src/M000055.html');return false;">
|
111
|
+
<span class="method-name">from_xml</span><span class="method-args">(xml)</span>
|
112
|
+
</a>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="method-description">
|
116
|
+
<p>
|
117
|
+
This assumes a standard xml format:
|
118
|
+
</p>
|
119
|
+
<pre>
|
120
|
+
<person attribute="">
|
121
|
+
<another_att>value</another_att>
|
122
|
+
</person>
|
123
|
+
</pre>
|
124
|
+
<p>
|
125
|
+
And for a collection of objects:
|
126
|
+
</p>
|
127
|
+
<pre>
|
128
|
+
<people>
|
129
|
+
<person attribute="">
|
130
|
+
<another_att>value 1</another_att>
|
131
|
+
</person>
|
132
|
+
<person attribute="">
|
133
|
+
<another_att>value 2</another_att>
|
134
|
+
</person>
|
135
|
+
</people>
|
136
|
+
</pre>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
<div id="validator-badges">
|
148
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
</body>
|
152
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
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>from_xml (SimpleMapper::XmlFormat::ClassMethods)</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/formats/xml_format.rb, line 31</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">xml</span>)
|
15
|
+
<span class="ruby-identifier">doc</span> = <span class="ruby-constant">Serialize</span>.<span class="ruby-identifier">hash_from_xml</span>(<span class="ruby-identifier">xml</span>)
|
16
|
+
<span class="ruby-comment cmt"># doc could include a single 'model' element, or a 'models' wrapper around several.</span>
|
17
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Top-level XML key(s): #{doc.keys.inspect}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@debug</span>
|
18
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">first</span>
|
19
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">doc</span>[<span class="ruby-identifier">key</span>].<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">uniq</span> <span class="ruby-operator">==</span> [<span class="ruby-identifier">key</span>.<span class="ruby-identifier">singularize</span>] <span class="ruby-operator">&&</span> <span class="ruby-identifier">doc</span>[<span class="ruby-identifier">key</span>][<span class="ruby-identifier">key</span>.<span class="ruby-identifier">singularize</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
20
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Several objects returned under key '#{key}'/'#{key.singularize}':"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@debug</span>
|
21
|
+
<span class="ruby-identifier">doc</span>[<span class="ruby-identifier">key</span>][<span class="ruby-identifier">key</span>.<span class="ruby-identifier">singularize</span>].<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
22
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Obj: #{e.inspect}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@debug</span>
|
23
|
+
<span class="ruby-constant">Object</span>.<span class="ruby-identifier">module_eval</span>(<span class="ruby-node">"::#{key.singularize.camelize}"</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">e</span>)
|
24
|
+
<span class="ruby-keyword kw">end</span>
|
25
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># top-level must be single object</span>
|
26
|
+
<span class="ruby-constant">Object</span>.<span class="ruby-identifier">module_eval</span>(<span class="ruby-node">"::#{key.singularize.camelize}"</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>).<span class="ruby-identifier">new</span>(<span class="ruby-constant">Serialize</span>.<span class="ruby-identifier">hash_from_xml</span>(<span class="ruby-identifier">xml</span>)[<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">underscore</span>])
|
27
|
+
<span class="ruby-keyword kw">end</span>
|
28
|
+
<span class="ruby-keyword kw">end</span></pre>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,169 @@
|
|
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: SimpleMapper::XmlFormat</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">SimpleMapper::XmlFormat</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/simple_mapper/formats/xml_format_rb.html">
|
59
|
+
lib/simple_mapper/formats/xml_format.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
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000052">included</a>
|
84
|
+
<a href="#M000053">mime_type_headers</a>
|
85
|
+
<a href="#M000054">to_xml</a>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<!-- if includes -->
|
93
|
+
|
94
|
+
<div id="section">
|
95
|
+
|
96
|
+
<div id="class-list">
|
97
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
98
|
+
|
99
|
+
Module <a href="XmlFormat/ClassMethods.html" class="link">SimpleMapper::XmlFormat::ClassMethods</a><br />
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Class methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000052" class="method-detail">
|
114
|
+
<a name="M000052"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="XmlFormat.src/M000052.html" target="Code" class="method-signature"
|
118
|
+
onclick="popupCode('XmlFormat.src/M000052.html');return false;">
|
119
|
+
<span class="method-name">included</span><span class="method-args">(base)</span>
|
120
|
+
</a>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div class="method-description">
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div id="method-M000053" class="method-detail">
|
128
|
+
<a name="M000053"></a>
|
129
|
+
|
130
|
+
<div class="method-heading">
|
131
|
+
<a href="XmlFormat.src/M000053.html" target="Code" class="method-signature"
|
132
|
+
onclick="popupCode('XmlFormat.src/M000053.html');return false;">
|
133
|
+
<span class="method-name">mime_type_headers</span><span class="method-args">()</span>
|
134
|
+
</a>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div class="method-description">
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
142
|
+
|
143
|
+
<div id="method-M000054" class="method-detail">
|
144
|
+
<a name="M000054"></a>
|
145
|
+
|
146
|
+
<div class="method-heading">
|
147
|
+
<a href="XmlFormat.src/M000054.html" target="Code" class="method-signature"
|
148
|
+
onclick="popupCode('XmlFormat.src/M000054.html');return false;">
|
149
|
+
<span class="method-name">to_xml</span><span class="method-args">()</span>
|
150
|
+
</a>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div class="method-description">
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
<div id="validator-badges">
|
165
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
</body>
|
169
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>included (SimpleMapper::XmlFormat)</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/formats/xml_format.rb, line 5</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
|
15
|
+
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|