simplemapper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/LICENSE +16 -0
  2. data/README +0 -0
  3. data/Rakefile +78 -0
  4. data/doc/classes/Array.html +139 -0
  5. data/doc/classes/Array.src/M000001.html +34 -0
  6. data/doc/classes/Callbacks.html +161 -0
  7. data/doc/classes/Callbacks.src/M000037.html +18 -0
  8. data/doc/classes/Callbacks.src/M000038.html +18 -0
  9. data/doc/classes/Callbacks.src/M000039.html +19 -0
  10. data/doc/classes/Enumerable.html +131 -0
  11. data/doc/classes/Enumerable.src/M000040.html +21 -0
  12. data/doc/classes/Hash.html +154 -0
  13. data/doc/classes/Hash.src/M000002.html +18 -0
  14. data/doc/classes/Hash.src/M000003.html +34 -0
  15. data/doc/classes/Inflector/Inflections.html +323 -0
  16. data/doc/classes/Inflector/Inflections.src/M000031.html +18 -0
  17. data/doc/classes/Inflector/Inflections.src/M000032.html +18 -0
  18. data/doc/classes/Inflector/Inflections.src/M000033.html +18 -0
  19. data/doc/classes/Inflector/Inflections.src/M000034.html +19 -0
  20. data/doc/classes/Inflector/Inflections.src/M000035.html +18 -0
  21. data/doc/classes/Inflector/Inflections.src/M000036.html +23 -0
  22. data/doc/classes/Inflector.html +516 -0
  23. data/doc/classes/Inflector.src/M000017.html +22 -0
  24. data/doc/classes/Inflector.src/M000018.html +25 -0
  25. data/doc/classes/Inflector.src/M000019.html +25 -0
  26. data/doc/classes/Inflector.src/M000020.html +22 -0
  27. data/doc/classes/Inflector.src/M000021.html +18 -0
  28. data/doc/classes/Inflector.src/M000022.html +22 -0
  29. data/doc/classes/Inflector.src/M000023.html +18 -0
  30. data/doc/classes/Inflector.src/M000024.html +18 -0
  31. data/doc/classes/Inflector.src/M000025.html +18 -0
  32. data/doc/classes/Inflector.src/M000026.html +18 -0
  33. data/doc/classes/Inflector.src/M000027.html +19 -0
  34. data/doc/classes/Inflector.src/M000028.html +18 -0
  35. data/doc/classes/Inflector.src/M000029.html +22 -0
  36. data/doc/classes/Inflector.src/M000030.html +27 -0
  37. data/doc/classes/Merb/Request.html +139 -0
  38. data/doc/classes/Merb/Request.src/M000041.html +22 -0
  39. data/doc/classes/Merb.html +111 -0
  40. data/doc/classes/OAuth/RequestProxy/Base.html +139 -0
  41. data/doc/classes/OAuth/RequestProxy/Base.src/M000012.html +18 -0
  42. data/doc/classes/OAuth/RequestProxy.html +111 -0
  43. data/doc/classes/OAuth/Signature/Base.html +139 -0
  44. data/doc/classes/OAuth/Signature/Base.src/M000011.html +25 -0
  45. data/doc/classes/OAuth/Signature.html +111 -0
  46. data/doc/classes/OAuth.html +112 -0
  47. data/doc/classes/OAuthController.html +243 -0
  48. data/doc/classes/OAuthController.src/M000005.html +22 -0
  49. data/doc/classes/OAuthController.src/M000006.html +18 -0
  50. data/doc/classes/OAuthController.src/M000007.html +18 -0
  51. data/doc/classes/OAuthController.src/M000008.html +25 -0
  52. data/doc/classes/OAuthController.src/M000009.html +19 -0
  53. data/doc/classes/Object.html +142 -0
  54. data/doc/classes/Object.src/M000010.html +19 -0
  55. data/doc/classes/Proc.html +143 -0
  56. data/doc/classes/Proc.src/M000004.html +18 -0
  57. data/doc/classes/Serialize.html +189 -0
  58. data/doc/classes/Serialize.src/M000013.html +21 -0
  59. data/doc/classes/Serialize.src/M000014.html +39 -0
  60. data/doc/classes/Serialize.src/M000015.html +16 -0
  61. data/doc/classes/Serialize.src/M000016.html +46 -0
  62. data/doc/classes/SimpleMapper/Base.html +528 -0
  63. data/doc/classes/SimpleMapper/Base.src/M000064.html +16 -0
  64. data/doc/classes/SimpleMapper/Base.src/M000065.html +16 -0
  65. data/doc/classes/SimpleMapper/Base.src/M000066.html +22 -0
  66. data/doc/classes/SimpleMapper/Base.src/M000067.html +21 -0
  67. data/doc/classes/SimpleMapper/Base.src/M000068.html +26 -0
  68. data/doc/classes/SimpleMapper/Base.src/M000069.html +18 -0
  69. data/doc/classes/SimpleMapper/Base.src/M000070.html +18 -0
  70. data/doc/classes/SimpleMapper/Base.src/M000071.html +18 -0
  71. data/doc/classes/SimpleMapper/Base.src/M000072.html +19 -0
  72. data/doc/classes/SimpleMapper/Base.src/M000073.html +23 -0
  73. data/doc/classes/SimpleMapper/Base.src/M000074.html +18 -0
  74. data/doc/classes/SimpleMapper/Base.src/M000075.html +20 -0
  75. data/doc/classes/SimpleMapper/Base.src/M000076.html +18 -0
  76. data/doc/classes/SimpleMapper/Base.src/M000077.html +18 -0
  77. data/doc/classes/SimpleMapper/Base.src/M000078.html +19 -0
  78. data/doc/classes/SimpleMapper/Base.src/M000079.html +18 -0
  79. data/doc/classes/SimpleMapper/Base.src/M000080.html +18 -0
  80. data/doc/classes/SimpleMapper/Base.src/M000081.html +19 -0
  81. data/doc/classes/SimpleMapper/Base.src/M000082.html +20 -0
  82. data/doc/classes/SimpleMapper/Base.src/M000083.html +24 -0
  83. data/doc/classes/SimpleMapper/Base.src/M000084.html +18 -0
  84. data/doc/classes/SimpleMapper/HttpAdapter.html +280 -0
  85. data/doc/classes/SimpleMapper/HttpAdapter.src/M000056.html +18 -0
  86. data/doc/classes/SimpleMapper/HttpAdapter.src/M000057.html +18 -0
  87. data/doc/classes/SimpleMapper/HttpAdapter.src/M000058.html +19 -0
  88. data/doc/classes/SimpleMapper/HttpAdapter.src/M000060.html +18 -0
  89. data/doc/classes/SimpleMapper/HttpAdapter.src/M000061.html +18 -0
  90. data/doc/classes/SimpleMapper/HttpAdapter.src/M000062.html +18 -0
  91. data/doc/classes/SimpleMapper/HttpAdapter.src/M000063.html +18 -0
  92. data/doc/classes/SimpleMapper/HttpOAuthExtension.html +188 -0
  93. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000048.html +49 -0
  94. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000049.html +23 -0
  95. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000050.html +18 -0
  96. data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000051.html +24 -0
  97. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.html +146 -0
  98. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/M000046.html +19 -0
  99. data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/M000047.html +19 -0
  100. data/doc/classes/SimpleMapper/SimpleModel.html +184 -0
  101. data/doc/classes/SimpleMapper/SimpleModel.src/M000042.html +18 -0
  102. data/doc/classes/SimpleMapper/SimpleModel.src/M000043.html +18 -0
  103. data/doc/classes/SimpleMapper/SimpleModel.src/M000044.html +18 -0
  104. data/doc/classes/SimpleMapper/SimpleModel.src/M000045.html +24 -0
  105. data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.html +152 -0
  106. data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.src/M000055.html +30 -0
  107. data/doc/classes/SimpleMapper/XmlFormat.html +169 -0
  108. data/doc/classes/SimpleMapper/XmlFormat.src/M000052.html +18 -0
  109. data/doc/classes/SimpleMapper/XmlFormat.src/M000053.html +18 -0
  110. data/doc/classes/SimpleMapper/XmlFormat.src/M000054.html +18 -0
  111. data/doc/classes/SimpleMapper.html +146 -0
  112. data/doc/classes/String.html +120 -0
  113. data/doc/created.rid +1 -0
  114. data/doc/files/lib/simple_mapper/adapters/http_adapter_rb.html +110 -0
  115. data/doc/files/lib/simple_mapper/base_rb.html +108 -0
  116. data/doc/files/lib/simple_mapper/default_plugins/callbacks_rb.html +101 -0
  117. data/doc/files/lib/simple_mapper/default_plugins/oauth_rb.html +116 -0
  118. data/doc/files/lib/simple_mapper/default_plugins/simple_model_rb.html +101 -0
  119. data/doc/files/lib/simple_mapper/formats/xml_format_rb.html +108 -0
  120. data/doc/files/lib/simple_mapper/support/bliss_serializer_rb.html +109 -0
  121. data/doc/files/lib/simple_mapper/support/core_ext_rb.html +108 -0
  122. data/doc/files/lib/simple_mapper/support/inflections_rb.html +101 -0
  123. data/doc/files/lib/simple_mapper/support/inflector_rb.html +108 -0
  124. data/doc/files/lib/simple_mapper/support_rb.html +109 -0
  125. data/doc/files/lib/simple_mapper_rb.html +137 -0
  126. data/doc/fr_class_index.html +52 -0
  127. data/doc/fr_file_index.html +38 -0
  128. data/doc/fr_method_index.html +110 -0
  129. data/doc/index.html +24 -0
  130. data/doc/rdoc-style.css +208 -0
  131. data/lib/simple_mapper/adapters/http_adapter.rb +64 -0
  132. data/lib/simple_mapper/base.rb +138 -0
  133. data/lib/simple_mapper/default_plugins/callbacks.rb +12 -0
  134. data/lib/simple_mapper/default_plugins/oauth.rb +167 -0
  135. data/lib/simple_mapper/default_plugins/simple_model.rb +36 -0
  136. data/lib/simple_mapper/formats/xml_format.rb +48 -0
  137. data/lib/simple_mapper/support/bliss_serializer.rb +168 -0
  138. data/lib/simple_mapper/support/core_ext.rb +73 -0
  139. data/lib/simple_mapper/support/inflections.rb +112 -0
  140. data/lib/simple_mapper/support/inflector.rb +275 -0
  141. data/lib/simple_mapper/support.rb +2 -0
  142. data/lib/simple_mapper.rb +16 -0
  143. metadata +236 -0
@@ -0,0 +1,21 @@
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>object_to_xml (Serialize)</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/bliss_serializer.rb, line 94</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">object_to_xml</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">options</span>={})
15
+ <span class="ruby-comment cmt"># Automatically set the key_name for DataMapper objects</span>
16
+ <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">:key_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">table</span>.<span class="ruby-identifier">key</span>.<span class="ruby-identifier">name</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:table</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:persistent?</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">persistent?</span>
17
+ <span class="ruby-comment cmt"># Should do the above also for ActiveRecord...</span>
18
+ <span class="ruby-identifier">to_xml</span>(<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">underscore</span>, <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to_hash</span>(<span class="ruby-identifier">options</span>), <span class="ruby-identifier">options</span>)
19
+ <span class="ruby-keyword kw">end</span></pre>
20
+ </body>
21
+ </html>
@@ -0,0 +1,39 @@
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_xml (Serialize)</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/bliss_serializer.rb, line 100</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_xml</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">attributes</span>={}, <span class="ruby-identifier">options</span>={})
15
+ <span class="ruby-identifier">options</span> = <span class="ruby-constant">XML_OPTIONS</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
16
+ <span class="ruby-identifier">attributes</span> = <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">stringify_keys!</span>
17
+
18
+ <span class="ruby-identifier">doc</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span>
19
+ <span class="ruby-identifier">root_element</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">root</span>)
20
+
21
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:include_key</span>]
22
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:attribute</span>
23
+ <span class="ruby-identifier">root_element</span>.<span class="ruby-identifier">add_attribute</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:key_name</span>], <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:key_name</span>].<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">extended</span> <span class="ruby-keyword kw">do</span>
24
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_string</span>; <span class="ruby-node">%Q[#@expanded_name=&quot;#{to_s().gsub(/&quot;/, '&amp;quot;')}&quot;]</span> <span class="ruby-keyword kw">end</span>
25
+ <span class="ruby-keyword kw">end</span>
26
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:element</span>
27
+ <span class="ruby-identifier">root_element</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:key_name</span>]) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Text</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:key_name</span>].<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">to_s</span>)
28
+ <span class="ruby-keyword kw">end</span>
29
+
30
+ <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">each</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>
31
+ <span class="ruby-identifier">node</span> = <span class="ruby-identifier">root_element</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">key</span>)
32
+ <span class="ruby-identifier">node</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Text</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
33
+ <span class="ruby-identifier">node</span>.<span class="ruby-identifier">add_attribute</span>(<span class="ruby-value str">'nil'</span>, <span class="ruby-value str">'true'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:report_nil</span>]
34
+ <span class="ruby-keyword kw">end</span>
35
+
36
+ <span class="ruby-identifier">doc</span>
37
+ <span class="ruby-keyword kw">end</span></pre>
38
+ </body>
39
+ </html>
@@ -0,0 +1,16 @@
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_string (Serialize)</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/bliss_serializer.rb, line 110</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_string</span>; <span class="ruby-node">%Q[#@expanded_name=&quot;#{to_s().gsub(/&quot;/, '&amp;quot;')}&quot;]</span> <span class="ruby-keyword kw">end</span></pre>
15
+ </body>
16
+ </html>
@@ -0,0 +1,46 @@
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>hash_from_xml (Serialize)</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/bliss_serializer.rb, line 125</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">hash_from_xml</span>(<span class="ruby-identifier">xml</span>,<span class="ruby-identifier">options</span>={})
15
+ <span class="ruby-identifier">options</span> = <span class="ruby-constant">XML_OPTIONS</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
16
+
17
+ <span class="ruby-identifier">stack</span> = []
18
+ <span class="ruby-identifier">parser</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Parsers</span><span class="ruby-operator">::</span><span class="ruby-constant">BaseParser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">xml</span>)
19
+
20
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
21
+ <span class="ruby-identifier">event</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">pull</span>
22
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">event</span>[<span class="ruby-value">0</span>]
23
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:end_document</span>
24
+ <span class="ruby-keyword kw">break</span>
25
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:end_doctype</span>, <span class="ruby-identifier">:start_doctype</span>
26
+ <span class="ruby-comment cmt"># do nothing</span>
27
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:start_element</span>
28
+ <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">push</span> <span class="ruby-constant">REXMLUtilityNode</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">event</span>[<span class="ruby-value">1</span>], <span class="ruby-identifier">event</span>[<span class="ruby-value">2</span>])
29
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:end_element</span>
30
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
31
+ <span class="ruby-identifier">temp</span> = <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">pop</span>
32
+ <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">add_node</span>(<span class="ruby-identifier">temp</span>)
33
+ <span class="ruby-keyword kw">end</span>
34
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>, <span class="ruby-identifier">:cdata</span>
35
+ <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">add_node</span>(<span class="ruby-identifier">event</span>[<span class="ruby-value">1</span>]) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">event</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
36
+ <span class="ruby-keyword kw">end</span>
37
+ <span class="ruby-keyword kw">end</span>
38
+ <span class="ruby-identifier">data</span> = <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">pop</span>.<span class="ruby-identifier">to_hash</span>
39
+
40
+ <span class="ruby-comment cmt"># Turn any {&quot;nil&quot; =&gt; &quot;true&quot;} into just nil</span>
41
+ <span class="ruby-identifier">data</span>.<span class="ruby-identifier">crawl</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> {}; <span class="ruby-identifier">v</span>} <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:report_nil</span>]
42
+ <span class="ruby-identifier">data</span>.<span class="ruby-identifier">crawl</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> {} <span class="ruby-operator">||</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> {<span class="ruby-value str">'nil'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'true'</span>}; <span class="ruby-identifier">v</span>} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:report_nil</span>]
43
+ <span class="ruby-identifier">data</span>
44
+ <span class="ruby-keyword kw">end</span></pre>
45
+ </body>
46
+ </html>
@@ -0,0 +1,528 @@
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>Class: SimpleMapper::Base</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>Class</strong></td>
53
+ <td class="class-name-in-header">SimpleMapper::Base</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/simple_mapper/base_rb.html">
59
+ lib/simple_mapper/base.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="../Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000068">connection</a>&nbsp;&nbsp;
92
+ <a href="#M000066">connection_adapter=</a>&nbsp;&nbsp;
93
+ <a href="#M000070">create</a>&nbsp;&nbsp;
94
+ <a href="#M000077">data</a>&nbsp;&nbsp;
95
+ <a href="#M000076">data=</a>&nbsp;&nbsp;
96
+ <a href="#M000065">debug!</a>&nbsp;&nbsp;
97
+ <a href="#M000064">debug?</a>&nbsp;&nbsp;
98
+ <a href="#M000083">delete</a>&nbsp;&nbsp;
99
+ <a href="#M000072">extract_from</a>&nbsp;&nbsp;
100
+ <a href="#M000073">extract_one</a>&nbsp;&nbsp;
101
+ <a href="#M000067">format=</a>&nbsp;&nbsp;
102
+ <a href="#M000079">formatted_data</a>&nbsp;&nbsp;
103
+ <a href="#M000069">get</a>&nbsp;&nbsp;
104
+ <a href="#M000078">instantiate</a>&nbsp;&nbsp;
105
+ <a href="#M000074">new</a>&nbsp;&nbsp;
106
+ <a href="#M000075">original_data=</a>&nbsp;&nbsp;
107
+ <a href="#M000084">persisted?</a>&nbsp;&nbsp;
108
+ <a href="#M000071">persistent?</a>&nbsp;&nbsp;
109
+ <a href="#M000082">post</a>&nbsp;&nbsp;
110
+ <a href="#M000081">put</a>&nbsp;&nbsp;
111
+ <a href="#M000080">save</a>&nbsp;&nbsp;
112
+ </div>
113
+ </div>
114
+
115
+ </div>
116
+
117
+
118
+ <!-- if includes -->
119
+
120
+ <div id="section">
121
+
122
+
123
+
124
+ <div id="aliases-list">
125
+ <h3 class="section-bar">External Aliases</h3>
126
+
127
+ <div class="name-list">
128
+ <table summary="aliases">
129
+ <tr class="top-aligned-row context-row">
130
+ <td class="context-item-name">connection_adapter=</td>
131
+ <td>-&gt;</td>
132
+ <td class="context-item-value">set_connection_adapter</td>
133
+ </tr>
134
+ <tr class="top-aligned-row context-row">
135
+ <td class="context-item-name">format=</td>
136
+ <td>-&gt;</td>
137
+ <td class="context-item-value">set_format</td>
138
+ </tr>
139
+ </table>
140
+ </div>
141
+ </div>
142
+
143
+
144
+ <div id="attribute-list">
145
+ <h3 class="section-bar">Attributes</h3>
146
+
147
+ <div class="name-list">
148
+ <table>
149
+ <tr class="top-aligned-row context-row">
150
+ <td class="context-item-name">format</td>
151
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
152
+ <td class="context-item-desc"></td>
153
+ </tr>
154
+ <tr class="top-aligned-row context-row">
155
+ <td class="context-item-name">format_name</td>
156
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
157
+ <td class="context-item-desc"></td>
158
+ </tr>
159
+ <tr class="top-aligned-row context-row">
160
+ <td class="context-item-name">identifier</td>
161
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
162
+ <td class="context-item-desc"></td>
163
+ </tr>
164
+ <tr class="top-aligned-row context-row">
165
+ <td class="context-item-name">original_attributes</td>
166
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
167
+ <td class="context-item-desc"></td>
168
+ </tr>
169
+ <tr class="top-aligned-row context-row">
170
+ <td class="context-item-name">original_data</td>
171
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
172
+ <td class="context-item-desc"></td>
173
+ </tr>
174
+ </table>
175
+ </div>
176
+ </div>
177
+
178
+
179
+
180
+ <!-- if method_list -->
181
+ <div id="methods">
182
+ <h3 class="section-bar">Public Class methods</h3>
183
+
184
+ <div id="method-M000068" class="method-detail">
185
+ <a name="M000068"></a>
186
+
187
+ <div class="method-heading">
188
+ <a href="Base.src/M000068.html" target="Code" class="method-signature"
189
+ onclick="popupCode('Base.src/M000068.html');return false;">
190
+ <span class="method-name">connection</span><span class="method-args">(refresh=false)</span>
191
+ </a>
192
+ </div>
193
+
194
+ <div class="method-description">
195
+ </div>
196
+ </div>
197
+
198
+ <div id="method-M000066" class="method-detail">
199
+ <a name="M000066"></a>
200
+
201
+ <div class="method-heading">
202
+ <a href="Base.src/M000066.html" target="Code" class="method-signature"
203
+ onclick="popupCode('Base.src/M000066.html');return false;">
204
+ <span class="method-name">connection_adapter=</span><span class="method-args">(adapter,debug=nil,&amp;block)</span>
205
+ </a>
206
+ </div>
207
+
208
+ <div class="method-description">
209
+ </div>
210
+ </div>
211
+
212
+ <div id="method-M000070" class="method-detail">
213
+ <a name="M000070"></a>
214
+
215
+ <div class="method-heading">
216
+ <a href="Base.src/M000070.html" target="Code" class="method-signature"
217
+ onclick="popupCode('Base.src/M000070.html');return false;">
218
+ <span class="method-name">create</span><span class="method-args">(*args)</span>
219
+ </a>
220
+ </div>
221
+
222
+ <div class="method-description">
223
+ <p>
224
+ new.save
225
+ </p>
226
+ </div>
227
+ </div>
228
+
229
+ <div id="method-M000065" class="method-detail">
230
+ <a name="M000065"></a>
231
+
232
+ <div class="method-heading">
233
+ <a href="Base.src/M000065.html" target="Code" class="method-signature"
234
+ onclick="popupCode('Base.src/M000065.html');return false;">
235
+ <span class="method-name">debug!</span><span class="method-args">()</span>
236
+ </a>
237
+ </div>
238
+
239
+ <div class="method-description">
240
+ </div>
241
+ </div>
242
+
243
+ <div id="method-M000064" class="method-detail">
244
+ <a name="M000064"></a>
245
+
246
+ <div class="method-heading">
247
+ <a href="Base.src/M000064.html" target="Code" class="method-signature"
248
+ onclick="popupCode('Base.src/M000064.html');return false;">
249
+ <span class="method-name">debug?</span><span class="method-args">()</span>
250
+ </a>
251
+ </div>
252
+
253
+ <div class="method-description">
254
+ </div>
255
+ </div>
256
+
257
+ <div id="method-M000072" class="method-detail">
258
+ <a name="M000072"></a>
259
+
260
+ <div class="method-heading">
261
+ <a href="Base.src/M000072.html" target="Code" class="method-signature"
262
+ onclick="popupCode('Base.src/M000072.html');return false;">
263
+ <span class="method-name">extract_from</span><span class="method-args">(formatted_data)</span>
264
+ </a>
265
+ </div>
266
+
267
+ <div class="method-description">
268
+ </div>
269
+ </div>
270
+
271
+ <div id="method-M000073" class="method-detail">
272
+ <a name="M000073"></a>
273
+
274
+ <div class="method-heading">
275
+ <a href="Base.src/M000073.html" target="Code" class="method-signature"
276
+ onclick="popupCode('Base.src/M000073.html');return false;">
277
+ <span class="method-name">extract_one</span><span class="method-args">(formatted_data, identifier=nil)</span>
278
+ </a>
279
+ </div>
280
+
281
+ <div class="method-description">
282
+ </div>
283
+ </div>
284
+
285
+ <div id="method-M000067" class="method-detail">
286
+ <a name="M000067"></a>
287
+
288
+ <div class="method-heading">
289
+ <a href="Base.src/M000067.html" target="Code" class="method-signature"
290
+ onclick="popupCode('Base.src/M000067.html');return false;">
291
+ <span class="method-name">format=</span><span class="method-args">(format)</span>
292
+ </a>
293
+ </div>
294
+
295
+ <div class="method-description">
296
+ <p>
297
+ set_format :xml self.format = :json
298
+ </p>
299
+ </div>
300
+ </div>
301
+
302
+ <div id="method-M000069" class="method-detail">
303
+ <a name="M000069"></a>
304
+
305
+ <div class="method-heading">
306
+ <a href="Base.src/M000069.html" target="Code" class="method-signature"
307
+ onclick="popupCode('Base.src/M000069.html');return false;">
308
+ <span class="method-name">get</span><span class="method-args">(*args)</span>
309
+ </a>
310
+ </div>
311
+
312
+ <div class="method-description">
313
+ <p>
314
+ <a href="Base.html#M000069">get</a>
315
+ </p>
316
+ </div>
317
+ </div>
318
+
319
+ <div id="method-M000074" class="method-detail">
320
+ <a name="M000074"></a>
321
+
322
+ <div class="method-heading">
323
+ <a href="Base.src/M000074.html" target="Code" class="method-signature"
324
+ onclick="popupCode('Base.src/M000074.html');return false;">
325
+ <span class="method-name">new</span><span class="method-args">(data=nil)</span>
326
+ </a>
327
+ </div>
328
+
329
+ <div class="method-description">
330
+ </div>
331
+ </div>
332
+
333
+ <div id="method-M000071" class="method-detail">
334
+ <a name="M000071"></a>
335
+
336
+ <div class="method-heading">
337
+ <a href="Base.src/M000071.html" target="Code" class="method-signature"
338
+ onclick="popupCode('Base.src/M000071.html');return false;">
339
+ <span class="method-name">persistent?</span><span class="method-args">()</span>
340
+ </a>
341
+ </div>
342
+
343
+ <div class="method-description">
344
+ </div>
345
+ </div>
346
+
347
+ <h3 class="section-bar">Public Instance methods</h3>
348
+
349
+ <div id="method-M000077" class="method-detail">
350
+ <a name="M000077"></a>
351
+
352
+ <div class="method-heading">
353
+ <a href="Base.src/M000077.html" target="Code" class="method-signature"
354
+ onclick="popupCode('Base.src/M000077.html');return false;">
355
+ <span class="method-name">data</span><span class="method-args">()</span>
356
+ </a>
357
+ </div>
358
+
359
+ <div class="method-description">
360
+ </div>
361
+ </div>
362
+
363
+ <div id="method-M000076" class="method-detail">
364
+ <a name="M000076"></a>
365
+
366
+ <div class="method-heading">
367
+ <a href="Base.src/M000076.html" target="Code" class="method-signature"
368
+ onclick="popupCode('Base.src/M000076.html');return false;">
369
+ <span class="method-name">data=</span><span class="method-args">(data)</span>
370
+ </a>
371
+ </div>
372
+
373
+ <div class="method-description">
374
+ </div>
375
+ </div>
376
+
377
+ <div id="method-M000083" class="method-detail">
378
+ <a name="M000083"></a>
379
+
380
+ <div class="method-heading">
381
+ <a href="Base.src/M000083.html" target="Code" class="method-signature"
382
+ onclick="popupCode('Base.src/M000083.html');return false;">
383
+ <span class="method-name">delete</span><span class="method-args">()</span>
384
+ </a>
385
+ </div>
386
+
387
+ <div class="method-description">
388
+ <p>
389
+ <a href="Base.html#M000083">delete</a>
390
+ </p>
391
+ </div>
392
+ </div>
393
+
394
+ <div id="method-M000079" class="method-detail">
395
+ <a name="M000079"></a>
396
+
397
+ <div class="method-heading">
398
+ <a href="Base.src/M000079.html" target="Code" class="method-signature"
399
+ onclick="popupCode('Base.src/M000079.html');return false;">
400
+ <span class="method-name">formatted_data</span><span class="method-args">()</span>
401
+ </a>
402
+ </div>
403
+
404
+ <div class="method-description">
405
+ <p>
406
+ Reads the <a href="Base.html#M000077">data</a> from the object for saving
407
+ back to the persisted store. This is provided as a default method, but you
408
+ can overwrite it in your model.
409
+ </p>
410
+ </div>
411
+ </div>
412
+
413
+ <div id="method-M000078" class="method-detail">
414
+ <a name="M000078"></a>
415
+
416
+ <div class="method-heading">
417
+ <a href="Base.src/M000078.html" target="Code" class="method-signature"
418
+ onclick="popupCode('Base.src/M000078.html');return false;">
419
+ <span class="method-name">instantiate</span><span class="method-args">(data)</span>
420
+ </a>
421
+ </div>
422
+
423
+ <div class="method-description">
424
+ <p>
425
+ Sets the <a href="Base.html#M000077">data</a> into the object. This is
426
+ provided as a default method, but your model can overwrite it any way you
427
+ want. For example, you could set the <a href="Base.html#M000077">data</a>
428
+ to some other object type, or to a Marshalled storage. The type of <a
429
+ href="Base.html#M000077">data</a> you receive will depend on the format and
430
+ parser you use. Of course you could make up your own spin-off of one of
431
+ those, too.
432
+ </p>
433
+ </div>
434
+ </div>
435
+
436
+ <div id="method-M000075" class="method-detail">
437
+ <a name="M000075"></a>
438
+
439
+ <div class="method-heading">
440
+ <a href="Base.src/M000075.html" target="Code" class="method-signature"
441
+ onclick="popupCode('Base.src/M000075.html');return false;">
442
+ <span class="method-name">original_data=</span><span class="method-args">(data)</span>
443
+ </a>
444
+ </div>
445
+
446
+ <div class="method-description">
447
+ </div>
448
+ </div>
449
+
450
+ <div id="method-M000084" class="method-detail">
451
+ <a name="M000084"></a>
452
+
453
+ <div class="method-heading">
454
+ <a href="Base.src/M000084.html" target="Code" class="method-signature"
455
+ onclick="popupCode('Base.src/M000084.html');return false;">
456
+ <span class="method-name">persisted?</span><span class="method-args">()</span>
457
+ </a>
458
+ </div>
459
+
460
+ <div class="method-description">
461
+ </div>
462
+ </div>
463
+
464
+ <div id="method-M000082" class="method-detail">
465
+ <a name="M000082"></a>
466
+
467
+ <div class="method-heading">
468
+ <a href="Base.src/M000082.html" target="Code" class="method-signature"
469
+ onclick="popupCode('Base.src/M000082.html');return false;">
470
+ <span class="method-name">post</span><span class="method-args">()</span>
471
+ </a>
472
+ </div>
473
+
474
+ <div class="method-description">
475
+ <p>
476
+ sends a <a href="Base.html#M000082">post</a> request with self.data
477
+ </p>
478
+ </div>
479
+ </div>
480
+
481
+ <div id="method-M000081" class="method-detail">
482
+ <a name="M000081"></a>
483
+
484
+ <div class="method-heading">
485
+ <a href="Base.src/M000081.html" target="Code" class="method-signature"
486
+ onclick="popupCode('Base.src/M000081.html');return false;">
487
+ <span class="method-name">put</span><span class="method-args">()</span>
488
+ </a>
489
+ </div>
490
+
491
+ <div class="method-description">
492
+ <p>
493
+ sends a <a href="Base.html#M000081">put</a> request with self.data
494
+ </p>
495
+ </div>
496
+ </div>
497
+
498
+ <div id="method-M000080" class="method-detail">
499
+ <a name="M000080"></a>
500
+
501
+ <div class="method-heading">
502
+ <a href="Base.src/M000080.html" target="Code" class="method-signature"
503
+ onclick="popupCode('Base.src/M000080.html');return false;">
504
+ <span class="method-name">save</span><span class="method-args">()</span>
505
+ </a>
506
+ </div>
507
+
508
+ <div class="method-description">
509
+ <p>
510
+ <a href="Base.html#M000084">persisted?</a> ? <a
511
+ href="Base.html#M000081">put</a> : <a href="Base.html#M000082">post</a>
512
+ </p>
513
+ </div>
514
+ </div>
515
+
516
+
517
+ </div>
518
+
519
+
520
+ </div>
521
+
522
+
523
+ <div id="validator-badges">
524
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
525
+ </div>
526
+
527
+ </body>
528
+ </html>