baccigalupi-aqua 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/.yardoc +0 -0
  2. data/Aqua.gemspec +20 -5
  3. data/README.rdoc +8 -4
  4. data/VERSION +1 -1
  5. data/doc/Aqua.html +1 -1
  6. data/doc/Aqua/Config.html +1 -1
  7. data/doc/Aqua/Config/ClassMethods.html +1 -1
  8. data/doc/Aqua/From.html +5 -5
  9. data/doc/Aqua/ObjectNotFound.html +1 -1
  10. data/doc/Aqua/Pack.html +1 -1
  11. data/doc/Aqua/Pack/ClassMethods.html +1 -1
  12. data/doc/Aqua/Pack/InstanceMethods.html +1 -1
  13. data/doc/Aqua/Query.html +1 -1
  14. data/doc/Aqua/Query/ClassMethods.html +1 -1
  15. data/doc/Aqua/Query/InstanceMethods.html +1 -1
  16. data/doc/Aqua/Storage.html +1 -1
  17. data/doc/Aqua/Store.html +1 -1
  18. data/doc/Aqua/Store/CouchDB.html +33 -33
  19. data/doc/Aqua/Store/CouchDB/Attachments.html +974 -0
  20. data/doc/Aqua/Store/CouchDB/Conflict.html +1 -1
  21. data/doc/Aqua/Store/CouchDB/Database.html +3 -3
  22. data/doc/Aqua/Store/CouchDB/DesignDocument.html +487 -0
  23. data/doc/Aqua/Store/CouchDB/RequestFailed.html +1 -1
  24. data/doc/Aqua/Store/CouchDB/RequestTimeout.html +1 -1
  25. data/doc/Aqua/Store/CouchDB/ResourceNotFound.html +1 -1
  26. data/doc/Aqua/Store/CouchDB/Server.html +1 -1
  27. data/doc/Aqua/Store/CouchDB/ServerBrokeConnection.html +1 -1
  28. data/doc/Aqua/Store/CouchDB/StorageMethods.html +1 -1
  29. data/doc/Aqua/Store/CouchDB/StorageMethods/ClassMethods.html +1 -1
  30. data/doc/Aqua/Store/CouchDB/StorageMethods/InstanceMethods.html +102 -2
  31. data/doc/Aqua/Stub.html +1 -1
  32. data/doc/Aqua/Tank.html +1 -1
  33. data/doc/Aqua/TempStub.html +1 -1
  34. data/doc/Aqua/To.html +10 -10
  35. data/doc/Aqua/Unpack.html +1 -1
  36. data/doc/Aqua/Unpack/ClassMethods.html +1 -1
  37. data/doc/Aqua/Unpack/InstanceMethods.html +1 -1
  38. data/doc/Array.html +13 -13
  39. data/doc/Bignum.html +5 -5
  40. data/doc/Date.html +5 -5
  41. data/doc/FalseClass.html +5 -5
  42. data/doc/Fixnum.html +5 -5
  43. data/doc/Float.html +5 -5
  44. data/doc/Hash.html +16 -16
  45. data/doc/OpenStruct.html +5 -5
  46. data/doc/README.rdoc.html +18 -10
  47. data/doc/Range.html +102 -0
  48. data/doc/Rational.html +9 -9
  49. data/doc/RestAPI.html +3 -3
  50. data/doc/RestClientAdapter.html +2 -2
  51. data/doc/Set.html +205 -0
  52. data/doc/Time.html +5 -5
  53. data/doc/TrueClass.html +5 -5
  54. data/doc/all-methods.html +126 -0
  55. data/doc/all-namespaces.html +8 -0
  56. data/doc/top-level-namespace.html +1 -1
  57. data/lib/aqua/object/pack.rb +1 -1
  58. data/lib/aqua/store/couch_db/attachments.rb +152 -0
  59. data/lib/aqua/store/couch_db/couch_db.rb +2 -0
  60. data/lib/aqua/store/couch_db/database.rb +1 -1
  61. data/lib/aqua/store/couch_db/design_document.rb +57 -0
  62. data/lib/aqua/store/couch_db/http_client/adapter/rest_client.rb +1 -1
  63. data/lib/aqua/store/couch_db/http_client/rest_api.rb +2 -2
  64. data/lib/aqua/store/couch_db/storage_methods.rb +12 -2
  65. data/lib/aqua/support/initializers.rb +12 -3
  66. data/lib/aqua/support/set.rb +27 -0
  67. data/spec/object/object_fixtures/sugar.rb +4 -0
  68. data/spec/object/pack_spec.rb +6 -0
  69. data/spec/object/unpack_spec.rb +18 -1
  70. data/spec/store/couchdb/attachments_spec.rb +127 -0
  71. data/spec/store/couchdb/design_document_spec.rb +43 -0
  72. data/spec/store/couchdb/{document_fixture.rb → fixtures_and_data/document_fixture.rb} +0 -0
  73. data/spec/store/couchdb/fixtures_and_data/image_attach.png +0 -0
  74. data/spec/store/couchdb/storage_methods_spec.rb +12 -4
  75. data/utils/custom.css +14 -0
  76. metadata +19 -4
data/.yardoc CHANGED
Binary file
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aqua}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kane Baccigalupi"]
12
- s.date = %q{2009-08-27}
12
+ s.date = %q{2009-08-31}
13
13
  s.description = %q{Even with ORMs like ActiveRecord, DataMapper which ease the pain of relational data storage, considerable developer effort goes into wrangling Ruby objects into their databases. Document-oriented databases have made it possible to store nested data structures that easily map to Ruby objects. Aqua (http://github.com/baccigalupi/aqua) is a new Ruby library that aims to painlessly persists objects, allowing developers to focus more on object oriented code and less on storage. Currently Aqua is in pre-alpha testing, with the following big things left to implement: A data query DSL and implementation; Support of all objects in the Standard Library; Class and code storage to allow the sharing and persistence of classes with their data.}
14
14
  s.email = %q{baccigalupi@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -40,8 +40,10 @@ Gem::Specification.new do |s|
40
40
  "doc/Aqua/Storage.html",
41
41
  "doc/Aqua/Store.html",
42
42
  "doc/Aqua/Store/CouchDB.html",
43
+ "doc/Aqua/Store/CouchDB/Attachments.html",
43
44
  "doc/Aqua/Store/CouchDB/Conflict.html",
44
45
  "doc/Aqua/Store/CouchDB/Database.html",
46
+ "doc/Aqua/Store/CouchDB/DesignDocument.html",
45
47
  "doc/Aqua/Store/CouchDB/RequestFailed.html",
46
48
  "doc/Aqua/Store/CouchDB/RequestTimeout.html",
47
49
  "doc/Aqua/Store/CouchDB/ResourceNotFound.html",
@@ -66,9 +68,11 @@ Gem::Specification.new do |s|
66
68
  "doc/Hash.html",
67
69
  "doc/OpenStruct.html",
68
70
  "doc/README.rdoc.html",
71
+ "doc/Range.html",
69
72
  "doc/Rational.html",
70
73
  "doc/RestAPI.html",
71
74
  "doc/RestClientAdapter.html",
75
+ "doc/Set.html",
72
76
  "doc/Time.html",
73
77
  "doc/TrueClass.html",
74
78
  "doc/all-files.html",
@@ -92,8 +96,10 @@ Gem::Specification.new do |s|
92
96
  "lib/aqua/object/stub.rb",
93
97
  "lib/aqua/object/tank.rb",
94
98
  "lib/aqua/object/unpack.rb",
99
+ "lib/aqua/store/couch_db/attachments.rb",
95
100
  "lib/aqua/store/couch_db/couch_db.rb",
96
101
  "lib/aqua/store/couch_db/database.rb",
102
+ "lib/aqua/store/couch_db/design_document.rb",
97
103
  "lib/aqua/store/couch_db/http_client/adapter/rest_client.rb",
98
104
  "lib/aqua/store/couch_db/http_client/rest_api.rb",
99
105
  "lib/aqua/store/couch_db/server.rb",
@@ -101,6 +107,7 @@ Gem::Specification.new do |s|
101
107
  "lib/aqua/store/storage.rb",
102
108
  "lib/aqua/support/initializers.rb",
103
109
  "lib/aqua/support/mash.rb",
110
+ "lib/aqua/support/set.rb",
104
111
  "lib/aqua/support/string_extensions.rb",
105
112
  "spec/aqua_spec.rb",
106
113
  "spec/object/config_spec.rb",
@@ -110,6 +117,7 @@ Gem::Specification.new do |s|
110
117
  "spec/object/object_fixtures/grounded.rb",
111
118
  "spec/object/object_fixtures/log.rb",
112
119
  "spec/object/object_fixtures/persistent.rb",
120
+ "spec/object/object_fixtures/sugar.rb",
113
121
  "spec/object/object_fixtures/user.rb",
114
122
  "spec/object/pack_spec.rb",
115
123
  "spec/object/query_spec.rb",
@@ -118,13 +126,17 @@ Gem::Specification.new do |s|
118
126
  "spec/object/unpack_spec.rb",
119
127
  "spec/spec.opts",
120
128
  "spec/spec_helper.rb",
129
+ "spec/store/couchdb/attachments_spec.rb",
121
130
  "spec/store/couchdb/couch_db_spec.rb",
122
131
  "spec/store/couchdb/database_spec.rb",
123
- "spec/store/couchdb/document_fixture.rb",
132
+ "spec/store/couchdb/design_document_spec.rb",
133
+ "spec/store/couchdb/fixtures_and_data/document_fixture.rb",
134
+ "spec/store/couchdb/fixtures_and_data/image_attach.png",
124
135
  "spec/store/couchdb/server_spec.rb",
125
136
  "spec/store/couchdb/storage_methods_spec.rb",
126
137
  "utils/code_statistics.rb",
127
- "utils/console"
138
+ "utils/console",
139
+ "utils/custom.css"
128
140
  ]
129
141
  s.has_rdoc = true
130
142
  s.homepage = %q{http://github.com/baccigalupi/aqua}
@@ -141,6 +153,7 @@ Gem::Specification.new do |s|
141
153
  "spec/object/object_fixtures/grounded.rb",
142
154
  "spec/object/object_fixtures/log.rb",
143
155
  "spec/object/object_fixtures/persistent.rb",
156
+ "spec/object/object_fixtures/sugar.rb",
144
157
  "spec/object/object_fixtures/user.rb",
145
158
  "spec/object/pack_spec.rb",
146
159
  "spec/object/query_spec.rb",
@@ -148,9 +161,11 @@ Gem::Specification.new do |s|
148
161
  "spec/object/tank_spec.rb",
149
162
  "spec/object/unpack_spec.rb",
150
163
  "spec/spec_helper.rb",
164
+ "spec/store/couchdb/attachments_spec.rb",
151
165
  "spec/store/couchdb/couch_db_spec.rb",
152
166
  "spec/store/couchdb/database_spec.rb",
153
- "spec/store/couchdb/document_fixture.rb",
167
+ "spec/store/couchdb/design_document_spec.rb",
168
+ "spec/store/couchdb/fixtures_and_data/document_fixture.rb",
154
169
  "spec/store/couchdb/server_spec.rb",
155
170
  "spec/store/couchdb/storage_methods_spec.rb"
156
171
  ]
@@ -6,13 +6,11 @@ Even with ORMs like ActiveRecord, DataMapper which ease the pain of relational d
6
6
 
7
7
  Currently Aqua is in pre-alpha testing, with the following big things left to implement:
8
8
  * A data query DSL and implementation (yeah, ouch!)
9
- * Support of all objects in the Standard Library
10
9
  * Class and code storage to allow the sharing and persistence of classes with their data
11
10
  * Other storage systems, most notably a filestore, so that users can try Aqua out without having to install CouchDb
12
- * Object keys, including symbols for hash-like objects
13
11
  * Data storage amenity add-ons including: validation, callbacks, AR-styled syntax, and properties that automate some of the object typing, validation, and searchability option.
14
12
 
15
- Aqua aims to be lean and modular, in addition to transparent. Currently it weighs in at 1000 lines of code with half of that for the CouchDB storage engine.
13
+ Aqua aims to be lean and modular, in addition to transparent. Currently it weighs in at < 1200 lines of code with half of that for the CouchDB storage engine.
16
14
 
17
15
  == Usage
18
16
 
@@ -76,7 +74,13 @@ Currently, Aqua uses CouchDB for its storage. Make sure you have CouchDB install
76
74
  Aqua is so young that it hasn't made it over to the established land of rubyforge. So for now you can install the gem by including github as a source, and then do a sudo gem install
77
75
 
78
76
  gem sources -a http://gems.github.com
79
- sudo gem install baccigalupi-aqua
77
+ sudo gem install 'baccigalupi-aqua'
78
+
79
+ Also, beware that Aqua has an unstated dependency: httpclient. The CouchDB engine was built with flexibility and speed in mind. The http_client gem seems like the best thing since sliced bread now, but may become outdated or slow comparatively. Developers are encouraged to build adapters to their preferred http clients. To do this please fork the project and request a pull once you have your adapter built and tested.
80
+
81
+ Meanwhile, you will want to make sure that httpclient is available to Aqua.
82
+
83
+ sudo gem install 'httpclient'
80
84
 
81
85
  == More Info
82
86
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -484,7 +484,7 @@ String with the full module name
484
484
  </div>
485
485
  </div>
486
486
  <div id="yard_info">
487
- Generated on Thursday, August 27 2009 at 05:50:25 PM by
487
+ Generated on Monday, August 31 2009 at 03:23:22 PM by
488
488
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
489
489
  0.2.3.5 (ruby-1.8.6).
490
490
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
  </div>
105
105
  <div id="yard_info">
106
- Generated on Thursday, August 27 2009 at 05:50:24 PM by
106
+ Generated on Monday, August 31 2009 at 03:23:20 PM by
107
107
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
108
108
  0.2.3.5 (ruby-1.8.6).
109
109
  </div>
@@ -151,7 +151,7 @@
151
151
  </div>
152
152
  </div>
153
153
  <div id="yard_info">
154
- Generated on Thursday, August 27 2009 at 05:50:25 PM by
154
+ Generated on Monday, August 31 2009 at 03:23:22 PM by
155
155
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
156
156
  0.2.3.5 (ruby-1.8.6).
157
157
  </div>
@@ -73,12 +73,12 @@ From
73
73
  <pre class="lines">
74
74
 
75
75
 
76
- 24
77
- 25
78
- 26</pre>
76
+ 27
77
+ 28
78
+ 29</pre>
79
79
  </td>
80
80
  <td>
81
- <pre class="code"><span class="info file"># File 'lib/aqua/support/initializers.rb', line 24</span>
81
+ <pre class="code"><span class="info file"># File 'lib/aqua/support/initializers.rb', line 27</span>
82
82
 
83
83
  <span class='def def kw'>def</span> <span class='aqua_init identifier id'>aqua_init</span><span class='lparen token'>(</span> <span class='init identifier id'>init</span> <span class='rparen token'>)</span>
84
84
  <span class='new identifier id'>new</span><span class='lparen token'>(</span> <span class='init identifier id'>init</span> <span class='rparen token'>)</span>
@@ -98,7 +98,7 @@ From
98
98
  </div>
99
99
  </div>
100
100
  <div id="yard_info">
101
- Generated on Thursday, August 27 2009 at 05:50:20 PM by
101
+ Generated on Monday, August 31 2009 at 03:23:17 PM by
102
102
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
103
103
  0.2.3.5 (ruby-1.8.6).
104
104
  </div>
@@ -25,7 +25,7 @@
25
25
  </div>
26
26
  </div>
27
27
  <div id="yard_info">
28
- Generated on Thursday, August 27 2009 at 05:50:21 PM by
28
+ Generated on Monday, August 31 2009 at 03:23:17 PM by
29
29
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
30
30
  0.2.3.5 (ruby-1.8.6).
31
31
  </div>
@@ -119,7 +119,7 @@ actual storage ivars. Aqua::Pack
119
119
  </div>
120
120
  </div>
121
121
  <div id="yard_info">
122
- Generated on Thursday, August 27 2009 at 05:50:23 PM by
122
+ Generated on Monday, August 31 2009 at 03:23:21 PM by
123
123
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
124
124
  0.2.3.5 (ruby-1.8.6).
125
125
  </div>
@@ -231,7 +231,7 @@ persistance
231
231
  </div>
232
232
  </div>
233
233
  <div id="yard_info">
234
- Generated on Thursday, August 27 2009 at 05:50:23 PM by
234
+ Generated on Monday, August 31 2009 at 03:23:20 PM by
235
235
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
236
236
  0.2.3.5 (ruby-1.8.6).
237
237
  </div>
@@ -926,7 +926,7 @@ Saves object and raises an error on failure
926
926
  </div>
927
927
  </div>
928
928
  <div id="yard_info">
929
- Generated on Thursday, August 27 2009 at 05:50:22 PM by
929
+ Generated on Monday, August 31 2009 at 03:23:18 PM by
930
930
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
931
931
  0.2.3.5 (ruby-1.8.6).
932
932
  </div>
@@ -99,7 +99,7 @@
99
99
  </div>
100
100
  </div>
101
101
  <div id="yard_info">
102
- Generated on Thursday, August 27 2009 at 05:50:21 PM by
102
+ Generated on Monday, August 31 2009 at 03:23:22 PM by
103
103
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
104
104
  0.2.3.5 (ruby-1.8.6).
105
105
  </div>
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  </div>
23
23
  <div id="yard_info">
24
- Generated on Thursday, August 27 2009 at 05:50:20 PM by
24
+ Generated on Monday, August 31 2009 at 03:23:19 PM by
25
25
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
26
26
  0.2.3.5 (ruby-1.8.6).
27
27
  </div>
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  </div>
23
23
  <div id="yard_info">
24
- Generated on Thursday, August 27 2009 at 05:50:23 PM by
24
+ Generated on Monday, August 31 2009 at 03:23:17 PM by
25
25
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
26
26
  0.2.3.5 (ruby-1.8.6).
27
27
  </div>
@@ -91,7 +91,7 @@ configuration of a store
91
91
  </div>
92
92
  </div>
93
93
  <div id="yard_info">
94
- Generated on Thursday, August 27 2009 at 05:50:20 PM by
94
+ Generated on Monday, August 31 2009 at 03:23:17 PM by
95
95
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
96
96
  0.2.3.5 (ruby-1.8.6).
97
97
  </div>
@@ -26,7 +26,7 @@ Store
26
26
  </div>
27
27
  </div>
28
28
  <div id="yard_info">
29
- Generated on Thursday, August 27 2009 at 05:50:23 PM by
29
+ Generated on Monday, August 31 2009 at 03:23:17 PM by
30
30
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
31
31
  0.2.3.5 (ruby-1.8.6).
32
32
  </div>
@@ -247,12 +247,12 @@ depend on usefulness outside this.
247
247
  <pre class="lines">
248
248
 
249
249
 
250
- 80
251
- 81
252
- 82</pre>
250
+ 82
251
+ 83
252
+ 84</pre>
253
253
  </td>
254
254
  <td>
255
- <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 80</span>
255
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 82</span>
256
256
 
257
257
  <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='clear_servers identifier id'>clear_servers</span>
258
258
  <span class='@servers ivar id'>@servers</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span>
@@ -328,14 +328,14 @@ converted
328
328
  <pre class="lines">
329
329
 
330
330
 
331
- 113
332
- 114
333
331
  115
334
332
  116
335
- 117</pre>
333
+ 117
334
+ 118
335
+ 119</pre>
336
336
  </td>
337
337
  <td>
338
- <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 113</span>
338
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 115</span>
339
339
 
340
340
  <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='escape identifier id'>escape</span><span class='lparen token'>(</span> <span class='str identifier id'>str</span> <span class='rparen token'>)</span>
341
341
  <span class='str identifier id'>str</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span><span class='lparen token'>(</span><span class='string val'>'::'</span><span class='comma token'>,</span> <span class='string val'>'__'</span><span class='rparen token'>)</span>
@@ -405,12 +405,12 @@ A string identifier for the HTTP adapter in use
405
405
  <pre class="lines">
406
406
 
407
407
 
408
- 18
409
- 19
410
- 20</pre>
408
+ 20
409
+ 21
410
+ 22</pre>
411
411
  </td>
412
412
  <td>
413
- <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 18</span>
413
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 20</span>
414
414
 
415
415
  <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='http_adapter identifier id'>http_adapter</span>
416
416
  <span class='@adapter ivar id'>@adapter</span> <span class='opasgn op'>||=</span> <span class='set_http_adapter identifier id'>set_http_adapter</span>
@@ -447,17 +447,17 @@ A string identifier for the HTTP adapter in use
447
447
  <pre class="lines">
448
448
 
449
449
 
450
- 137
451
- 138
452
450
  139
453
451
  140
454
452
  141
455
453
  142
456
454
  143
457
- 144</pre>
455
+ 144
456
+ 145
457
+ 146</pre>
458
458
  </td>
459
459
  <td>
460
- <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 137</span>
460
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 139</span>
461
461
 
462
462
  <span class='def def kw'>def</span> <span class='method_missing identifier id'>method_missing</span><span class='lparen token'>(</span> <span class='method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span> <span class='rparen token'>)</span>
463
463
  <span class='if if kw'>if</span> <span class='@adapter ivar id'>@adapter</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
@@ -510,8 +510,6 @@ query string.
510
510
  <pre class="lines">
511
511
 
512
512
 
513
- 94
514
- 95
515
513
  96
516
514
  97
517
515
  98
@@ -519,10 +517,12 @@ query string.
519
517
  100
520
518
  101
521
519
  102
522
- 103</pre>
520
+ 103
521
+ 104
522
+ 105</pre>
523
523
  </td>
524
524
  <td>
525
- <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 94</span>
525
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 96</span>
526
526
 
527
527
  <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='paramify_url identifier id'>paramify_url</span><span class='lparen token'>(</span> <span class='url identifier id'>url</span><span class='comma token'>,</span> <span class='params identifier id'>params</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span> <span class='rparen token'>)</span>
528
528
  <span class='if if kw'>if</span> <span class='params identifier id'>params</span> <span class='andop op'>&amp;&amp;</span> <span class='notop op'>!</span><span class='params identifier id'>params</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span>
@@ -576,16 +576,16 @@ memory so that there is only one instance of a Server per namespace.
576
576
  <pre class="lines">
577
577
 
578
578
 
579
- 68
580
- 69
581
579
  70
582
580
  71
583
581
  72
584
582
  73
585
- 74</pre>
583
+ 74
584
+ 75
585
+ 76</pre>
586
586
  </td>
587
587
  <td>
588
- <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 68</span>
588
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 70</span>
589
589
 
590
590
  <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='server identifier id'>server</span><span class='lparen token'>(</span> <span class='namespace identifier id'>namespace</span><span class='assign token'>=</span><span class='nil nil kw'>nil</span> <span class='rparen token'>)</span>
591
591
  <span class='namespace identifier id'>namespace</span> <span class='opasgn op'>||=</span> <span class='symbol val'>:aqua</span>
@@ -634,12 +634,12 @@ Cache of CouchDB Servers used by Aqua. Each is identified by its namespace.
634
634
  <pre class="lines">
635
635
 
636
636
 
637
- 58
638
- 59
639
- 60</pre>
637
+ 60
638
+ 61
639
+ 62</pre>
640
640
  </td>
641
641
  <td>
642
- <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 58</span>
642
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 60</span>
643
643
 
644
644
  <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='servers identifier id'>servers</span>
645
645
  <span class='@servers ivar id'>@servers</span> <span class='opasgn op'>||=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span>
@@ -726,8 +726,6 @@ Name of HTTP Client Adapter module
726
726
  <pre class="lines">
727
727
 
728
728
 
729
- 37
730
- 38
731
729
  39
732
730
  40
733
731
  41
@@ -742,10 +740,12 @@ Name of HTTP Client Adapter module
742
740
  50
743
741
  51
744
742
  52
745
- 53</pre>
743
+ 53
744
+ 54
745
+ 55</pre>
746
746
  </td>
747
747
  <td>
748
- <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 37</span>
748
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/couch_db.rb', line 39</span>
749
749
 
750
750
  <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='set_http_adapter identifier id'>set_http_adapter</span><span class='lparen token'>(</span> <span class='mod_string identifier id'>mod_string</span><span class='assign token'>=</span><span class='string val'>'RestClientAdapter'</span> <span class='rparen token'>)</span>
751
751
 
@@ -779,7 +779,7 @@ Name of HTTP Client Adapter module
779
779
  </div>
780
780
  </div>
781
781
  <div id="yard_info">
782
- Generated on Thursday, August 27 2009 at 05:50:23 PM by
782
+ Generated on Monday, August 31 2009 at 03:23:17 PM by
783
783
  <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
784
784
  0.2.3.5 (ruby-1.8.6).
785
785
  </div>
@@ -0,0 +1,974 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <link rel="stylesheet" href="../../../style.css" type="text/css" charset="utf-8" />
7
+ <link rel="stylesheet" href="../../../custom.css" type="text/css" charset="utf-8" />
8
+ <link rel="stylesheet" href="../../../syntax_highlight.css" type="text/css" charset="utf-8" />
9
+
10
+ <script src="../../../jquery.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="../../../app.js" type="text/javascript" charset="utf-8"></script>
12
+ <title>Class: Aqua::Store::CouchDB::Attachments</title>
13
+ </head>
14
+ <body>
15
+ <div id="content">
16
+ <div class="section class Aqua_Store_CouchDB_Attachments">
17
+ <h1 class="title">Class: Aqua::Store::CouchDB::Attachments</h1>
18
+ <div class="section inheritance">
19
+ <ul>
20
+ <li>Mash</li><ul><li>Aqua::Store::CouchDB::Attachments</li>
21
+ </ul></ul>
22
+ </div><div class="section docstring">
23
+ <p>
24
+ Attachments is a Hash-like container with keys that are attacment names and
25
+ values that are file-type objects. Initializing and adding to the
26
+ collection assures the types of both keys and values. The collection
27
+ implements a lazy-loading scheme, such that when an attachment is requested
28
+ and not found, it will try to load it from CouchDB. Attachments
29
+ </p>
30
+
31
+ </div><div class="section attributes">
32
+ <h1>Attributes</h1>
33
+
34
+
35
+ <div class="instance">
36
+ <h2>Instance Attributes</h2>
37
+ <table>
38
+
39
+
40
+ <tr class="">
41
+ <th class='signature'>
42
+ <span class='name'>document</span>
43
+ </td>
44
+ <td class="readwrite">
45
+ [<span id='document-instance_method'>R</span>]
46
+ </td>
47
+ <td class="visibility">
48
+ public
49
+ </td>
50
+ <td class="docstring">
51
+ <p>
52
+ Returns the value of attribute <tt>document</tt>.
53
+ </p>
54
+
55
+
56
+ </td>
57
+ </tr>
58
+
59
+
60
+
61
+ <tr class="">
62
+ <th class='signature'>
63
+ <span class='name'>stub</span>
64
+ </td>
65
+ <td class="readwrite">
66
+ [<span id='stub-instance_method'>R</span>]
67
+ </td>
68
+ <td class="visibility">
69
+ public
70
+ </td>
71
+ <td class="docstring">
72
+ <p>
73
+ Returns the value of attribute <tt>stub</tt>.
74
+ </p>
75
+
76
+
77
+ </td>
78
+ </tr>
79
+
80
+
81
+ </table>
82
+ </div>
83
+
84
+ </div>
85
+ <div class="section constants">
86
+
87
+ </div><div class="section constructor">
88
+ <h1>Constructor Summary</h1>
89
+ <div id="initialize-instance_method" class="section method">
90
+ <div class="details_title">
91
+ <div class='section methodsignature'>
92
+ <tt class='def'>
93
+ <span class='visibility'>public</span>
94
+ <span class='return_types'></span>
95
+ <span class='name'>initialize</span><span class='args'>(doc, hash = {})</span>
96
+ <span class='block'></span>
97
+ </tt>
98
+ </div>
99
+
100
+ </div><div class="section docstring">
101
+ <p>
102
+ Creates a new attachment collection with keys that are attachment names and
103
+ values that are file-type objects. The collection manages both the key and
104
+ the value types.
105
+ </p>
106
+
107
+ </div><div class="section tags">
108
+ <h2>Meta Tags</h2>
109
+ <div class="raise">
110
+ <h3>Raises:</h3>
111
+ <dl>
112
+
113
+ <dt>
114
+
115
+ <span class='type'>[<tt>ArgumentError</tt>]</span>
116
+
117
+
118
+
119
+ </dt>
120
+ <dd>
121
+ <span class='desc'></span>
122
+ </dd>
123
+
124
+ </dl>
125
+ </div>
126
+
127
+ </div><div class="section source">
128
+ <span>[<a class="source_link" href="#">View source</a>]</span>
129
+ <div class="source_code">
130
+ <table>
131
+ <tr>
132
+ <td>
133
+ <pre class="lines">
134
+
135
+
136
+ 22
137
+ 23
138
+ 24
139
+ 25
140
+ 26
141
+ 27</pre>
142
+ </td>
143
+ <td>
144
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 22</span>
145
+
146
+ <span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span> <span class='doc identifier id'>doc</span><span class='comma token'>,</span> <span class='hash identifier id'>hash</span><span class='assign token'>=</span><span class='lbrace token'>{</span><span class='rbrace token'>}</span> <span class='rparen token'>)</span>
147
+ <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>&quot;must be initialized with a document&quot;</span> <span class='unless unless_mod kw'>unless</span> <span class='doc identifier id'>doc</span><span class='dot token'>.</span><span class='respond_to? fid id'>respond_to?</span><span class='lparen token'>(</span> <span class='symbol val'>:retrieve</span> <span class='rparen token'>)</span>
148
+ <span class='@document ivar id'>@document</span> <span class='assign token'>=</span> <span class='doc identifier id'>doc</span>
149
+ <span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='validate_hash identifier id'>validate_hash</span><span class='lparen token'>(</span> <span class='hash identifier id'>hash</span> <span class='rparen token'>)</span> <span class='unless unless_mod kw'>unless</span> <span class='hash identifier id'>hash</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span>
150
+ <span class='super super kw'>super</span><span class='lparen token'>(</span> <span class='hash identifier id'>hash</span> <span class='rparen token'>)</span>
151
+ <span class='end end kw'>end</span>
152
+ </pre>
153
+ </td>
154
+ </tr>
155
+ </table>
156
+ </div>
157
+ </div>
158
+ </div>
159
+ </div> <div class="section visibilitygroup public">
160
+ <h1>Public Visibility</h1>
161
+ <div class="section methodsummary class public">
162
+ <h1>Public Class Method Summary</h1>
163
+ <table class="summary">
164
+
165
+ <tr>
166
+ <th class="signature">
167
+
168
+ <span class='overload'>
169
+ <span class='name'><a href="#validate_hash-class_method" title="validate_hash">validate_hash</a></span><span class='args'>(hash)</span>
170
+ <span class='block'></span>
171
+ </span>
172
+
173
+
174
+ </th>
175
+ <td class="docstring">
176
+ <p>
177
+ Validates and throws an error on a hash, insisting that the key is a string
178
+ or symbol, and the value is a file.
179
+ </p>
180
+
181
+
182
+ </td>
183
+ </tr>
184
+
185
+ </table>
186
+
187
+ </div>
188
+ <div class="section methodsummary instance public">
189
+ <h1>Public Instance Method Summary</h1>
190
+ <table class="summary">
191
+
192
+ <tr>
193
+ <th class="signature">
194
+
195
+ <span class='overload'>
196
+ <span class='name'><a href="#add-instance_method" title="#add">#add</a></span><span class='args'>(name, file)</span>
197
+ <span class='block'></span>
198
+ </span>
199
+
200
+
201
+ </th>
202
+ <td class="docstring">
203
+ <p>
204
+ Adds an attachment to the collection, checking for type.
205
+ </p>
206
+
207
+
208
+ </td>
209
+ </tr>
210
+
211
+ <tr>
212
+ <th class="signature">
213
+
214
+ <span class='overload'>
215
+ <span class='name'><a href="#add%21-instance_method" title="#add!">#add!</a></span><span class='args'>(name, file)</span>
216
+ <span class='block'></span>
217
+ </span>
218
+
219
+
220
+ </th>
221
+ <td class="docstring">
222
+ <p>
223
+ Adds an attachment to the collection and to the database.
224
+ </p>
225
+
226
+
227
+ </td>
228
+ </tr>
229
+
230
+ <tr>
231
+ <th class="signature">
232
+
233
+ <span class='overload'>
234
+ <span class='name'><a href="#delete%21-instance_method" title="#delete!">#delete!</a></span><span class='args'>(name)</span>
235
+ <span class='block'></span>
236
+ </span>
237
+
238
+
239
+ </th>
240
+ <td class="docstring">
241
+ <p>
242
+ Deletes an attachment from the collection, and from the database.
243
+ </p>
244
+
245
+
246
+ <p class='returns'>
247
+ Returns:
248
+ <span class='return_types'>
249
+ <tt>File</tt>
250
+ </span>
251
+ </p>
252
+
253
+ </td>
254
+ </tr>
255
+
256
+ <tr>
257
+ <th class="signature">
258
+
259
+ <span class='overload'>
260
+ <span class='name'><a href="#get-instance_method" title="#get">#get</a></span><span class='args'>(name, stream = false)</span>
261
+ <span class='block'></span>
262
+ </span>
263
+
264
+
265
+ </th>
266
+ <td class="docstring">
267
+ <p>
268
+ Gets an attachment from the collection first.
269
+ </p>
270
+
271
+
272
+ <p class='returns'>
273
+ Returns:
274
+ <span class='return_types'>
275
+ <tt>File</tt>
276
+ </span>
277
+ </p>
278
+
279
+ </td>
280
+ </tr>
281
+
282
+ <tr>
283
+ <th class="signature">
284
+
285
+ <span class='overload'>
286
+ <span class='name'><a href="#get%21-instance_method" title="#get!">#get!</a></span><span class='args'>(name, stream = false)</span>
287
+ <span class='block'></span>
288
+ </span>
289
+
290
+
291
+ </th>
292
+ <td class="docstring">
293
+ <p>
294
+ Gets an attachment from the database.
295
+ </p>
296
+
297
+
298
+ <p class='returns'>
299
+ Returns:
300
+ <span class='return_types'>
301
+ <tt>File</tt>
302
+ </span>
303
+ </p>
304
+
305
+ </td>
306
+ </tr>
307
+
308
+ <tr>
309
+ <th class="signature">
310
+
311
+ <span class='overload'>
312
+ <span class='name'><a href="#update_doc_rev-instance_method" title="#update_doc_rev">#update_doc_rev</a></span><span class='args'>(response)</span>
313
+ <span class='block'></span>
314
+ </span>
315
+
316
+
317
+ </th>
318
+ <td class="docstring">
319
+ <p>
320
+ Goes into the document and updates it&#8217;s rev to match the returned
321
+ rev.
322
+ </p>
323
+
324
+
325
+ </td>
326
+ </tr>
327
+
328
+ <tr>
329
+ <th class="signature">
330
+
331
+ <span class='overload'>
332
+ <span class='name'><a href="#uri_for-instance_method" title="#uri_for">#uri_for</a></span><span class='args'>(name, include_rev = true)</span>
333
+ <span class='block'></span>
334
+ </span>
335
+
336
+
337
+ </th>
338
+ <td class="docstring">
339
+ <p>
340
+ Constructs the standalone attachment uri for PUT and DELETE actions.
341
+ </p>
342
+
343
+
344
+ </td>
345
+ </tr>
346
+
347
+ </table>
348
+
349
+ </div>
350
+ <div class="section methoddetails class public">
351
+ <h1>Public Class Method Details</h1>
352
+
353
+ <div class="method">
354
+ <div class="method_header">
355
+ <h3>validate_hash</h3>
356
+ </div><div id="validate_hash-class_method" class="section method">
357
+ <div class="details_title">
358
+ <div class='section methodsignature'>
359
+ <tt class='def'>
360
+ <span class='visibility'>public</span>
361
+ <span class='return_types'></span>
362
+ <span class='name'>validate_hash</span><span class='args'>(hash)</span>
363
+ <span class='block'></span>
364
+ </tt>
365
+ </div>
366
+
367
+ </div><div class="section docstring">
368
+ <p>
369
+ Validates and throws an error on a hash, insisting that the key is a string
370
+ or symbol, and the value is a file.
371
+ </p>
372
+
373
+ </div><div class="section tags">
374
+ <h2>Meta Tags</h2>
375
+
376
+ </div><div class="section source">
377
+ <span>[<a class="source_link" href="#">View source</a>]</span>
378
+ <div class="source_code">
379
+ <table>
380
+ <tr>
381
+ <td>
382
+ <pre class="lines">
383
+
384
+
385
+ 132
386
+ 133
387
+ 134
388
+ 135
389
+ 136
390
+ 137</pre>
391
+ </td>
392
+ <td>
393
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 132</span>
394
+
395
+ <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='validate_hash identifier id'>validate_hash</span><span class='lparen token'>(</span> <span class='hash identifier id'>hash</span> <span class='rparen token'>)</span>
396
+ <span class='hash identifier id'>hash</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='file identifier id'>file</span><span class='bitor op'>|</span>
397
+ <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='dstring node'>&quot;Attachment name, #{name.inspect}, must be a Symbol or a String&quot;</span> <span class='unless unless_mod kw'>unless</span> <span class='lbrack token'>[</span><span class='Symbol constant id'>Symbol</span><span class='comma token'>,</span> <span class='String constant id'>String</span> <span class='rbrack token'>]</span><span class='dot token'>.</span><span class='include? fid id'>include?</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='dot token'>.</span><span class='class identifier id'>class</span> <span class='rparen token'>)</span>
398
+ <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='dstring node'>&quot;Attachment file, #{file.inspect}, must be a File-like object&quot;</span> <span class='unless unless_mod kw'>unless</span> <span class='file identifier id'>file</span><span class='dot token'>.</span><span class='respond_to? fid id'>respond_to?</span><span class='lparen token'>(</span> <span class='symbol val'>:read</span> <span class='rparen token'>)</span>
399
+ <span class='end end kw'>end</span>
400
+ <span class='end end kw'>end</span>
401
+ </pre>
402
+ </td>
403
+ </tr>
404
+ </table>
405
+ </div>
406
+ </div>
407
+ </div>
408
+ </div>
409
+
410
+ </div><div class="section methoddetails instance public">
411
+ <h1>Public Instance Method Details</h1>
412
+
413
+ <div class="method">
414
+ <div class="method_header">
415
+ <h3>add</h3>
416
+ </div><div id="add-instance_method" class="section method">
417
+ <div class="details_title">
418
+ <div class='section methodsignature'>
419
+ <tt class='def'>
420
+ <span class='visibility'>public</span>
421
+ <span class='return_types'></span>
422
+ <span class='name'>add</span><span class='args'>(name, file)</span>
423
+ <span class='block'></span>
424
+ </tt>
425
+ </div>
426
+
427
+ </div><div class="section docstring">
428
+ <p>
429
+ Adds an attachment to the collection, checking for type. Does not add
430
+ directly to the database.
431
+ </p>
432
+
433
+ </div><div class="section tags">
434
+ <h2>Meta Tags</h2>
435
+
436
+ </div><div class="section source">
437
+ <span>[<a class="source_link" href="#">View source</a>]</span>
438
+ <div class="source_code">
439
+ <table>
440
+ <tr>
441
+ <td>
442
+ <pre class="lines">
443
+
444
+
445
+ 35
446
+ 36
447
+ 37
448
+ 38</pre>
449
+ </td>
450
+ <td>
451
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 35</span>
452
+
453
+ <span class='def def kw'>def</span> <span class='add identifier id'>add</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='file identifier id'>file</span> <span class='rparen token'>)</span>
454
+ <span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='validate_hash identifier id'>validate_hash</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='file identifier id'>file</span> <span class='rparen token'>)</span>
455
+ <span class='self self kw'>self</span><span class='lbrack token'>[</span><span class='name identifier id'>name</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='file identifier id'>file</span>
456
+ <span class='end end kw'>end</span>
457
+ </pre>
458
+ </td>
459
+ </tr>
460
+ </table>
461
+ </div>
462
+ </div>
463
+ </div>
464
+ </div>
465
+
466
+ <div class="method">
467
+ <div class="method_header">
468
+ <h3>add!</h3>
469
+ </div><div id="add!-instance_method" class="section method">
470
+ <div class="details_title">
471
+ <div class='section methodsignature'>
472
+ <tt class='def'>
473
+ <span class='visibility'>public</span>
474
+ <span class='return_types'></span>
475
+ <span class='name'>add!</span><span class='args'>(name, file)</span>
476
+ <span class='block'></span>
477
+ </tt>
478
+ </div>
479
+
480
+ </div><div class="section docstring">
481
+ <p>
482
+ Adds an attachment to the collection and to the database. Document
483
+ doesn&#8217;t have to be saved, but it does need to have an id.
484
+ </p>
485
+
486
+ </div><div class="section tags">
487
+ <h2>Meta Tags</h2>
488
+
489
+ </div><div class="section source">
490
+ <span>[<a class="source_link" href="#">View source</a>]</span>
491
+ <div class="source_code">
492
+ <table>
493
+ <tr>
494
+ <td>
495
+ <pre class="lines">
496
+
497
+
498
+ 47
499
+ 48
500
+ 49
501
+ 50
502
+ 51
503
+ 52
504
+ 53
505
+ 54
506
+ 55
507
+ 56
508
+ 57
509
+ 58</pre>
510
+ </td>
511
+ <td>
512
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 47</span>
513
+
514
+ <span class='def def kw'>def</span> <span class='add! fid id'>add!</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='file identifier id'>file</span> <span class='rparen token'>)</span>
515
+ <span class='add identifier id'>add</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='file identifier id'>file</span> <span class='rparen token'>)</span>
516
+ <span class='content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='MIME constant id'>MIME</span><span class='colon2 op'>::</span><span class='Types constant id'>Types</span><span class='dot token'>.</span><span class='type_for identifier id'>type_for</span><span class='lparen token'>(</span><span class='file identifier id'>file</span><span class='dot token'>.</span><span class='path identifier id'>path</span><span class='rparen token'>)</span>
517
+ <span class='content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='content_type identifier id'>content_type</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span> <span class='integer val'>? </span><span class='string val'>'text\/plain'</span> <span class='colon op'>:</span> <span class='content_type identifier id'>content_type</span>
518
+ <span class='data identifier id'>data</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span>
519
+ <span class='string val'>'content-type'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='content_type identifier id'>content_type</span><span class='comma token'>,</span>
520
+ <span class='string val'>'data'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='Base64 constant id'>Base64</span><span class='dot token'>.</span><span class='encode64 identifier id'>encode64</span><span class='lparen token'>(</span> <span class='file identifier id'>file</span><span class='dot token'>.</span><span class='read identifier id'>read</span> <span class='rparen token'>)</span><span class='dot token'>.</span><span class='gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='regexp val'>/\s/</span><span class='comma token'>,</span><span class='string val'>''</span><span class='rparen token'>)</span>
521
+ <span class='rbrace token'>}</span>
522
+ <span class='response identifier id'>response</span> <span class='assign token'>=</span> <span class='CouchDB constant id'>CouchDB</span><span class='dot token'>.</span><span class='put identifier id'>put</span><span class='lparen token'>(</span> <span class='uri_for identifier id'>uri_for</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span> <span class='rparen token'>)</span><span class='comma token'>,</span> <span class='data identifier id'>data</span> <span class='rparen token'>)</span>
523
+ <span class='update_doc_rev identifier id'>update_doc_rev</span><span class='lparen token'>(</span> <span class='response identifier id'>response</span> <span class='rparen token'>)</span>
524
+ <span class='file identifier id'>file</span>
525
+ <span class='end end kw'>end</span>
526
+ </pre>
527
+ </td>
528
+ </tr>
529
+ </table>
530
+ </div>
531
+ </div>
532
+ </div>
533
+ </div>
534
+
535
+ <div class="method">
536
+ <div class="method_header">
537
+ <h3>delete!</h3>
538
+ </div><div id="delete!-instance_method" class="section method">
539
+ <div class="details_title">
540
+ <div class='section methodsignature'>
541
+ <tt class='def'>
542
+ <span class='visibility'>public</span>
543
+ <span class='return_types'><tt>File</tt></span>
544
+ <span class='name'>delete!</span><span class='args'>(name)</span>
545
+ <span class='block'></span>
546
+ </tt>
547
+ </div>
548
+
549
+ </div><div class="section docstring">
550
+ <p>
551
+ Deletes an attachment from the collection, and from the database. Use
552
+ #delete (from Hash) to just delete the attachment from the collection.
553
+ </p>
554
+
555
+ </div><div class="section tags">
556
+ <h2>Meta Tags</h2>
557
+ <div class="return">
558
+ <h3>Returns:</h3>
559
+ <dl>
560
+
561
+ <dt>
562
+
563
+ <span class='type'>[<tt>File</tt>, <tt>nil</tt>]</span>
564
+
565
+
566
+ <span class='name'></span>
567
+
568
+
569
+ </dt>
570
+ <dd>
571
+ <span class='desc'><p>
572
+ File at that location or nil if no file found
573
+ </p>
574
+ </span>
575
+ </dd>
576
+
577
+ </dl>
578
+ </div>
579
+
580
+ </div><div class="section source">
581
+ <span>[<a class="source_link" href="#">View source</a>]</span>
582
+ <div class="source_code">
583
+ <table>
584
+ <tr>
585
+ <td>
586
+ <pre class="lines">
587
+
588
+
589
+ 67
590
+ 68
591
+ 69
592
+ 70
593
+ 71
594
+ 72
595
+ 73
596
+ 74
597
+ 75</pre>
598
+ </td>
599
+ <td>
600
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 67</span>
601
+
602
+ <span class='def def kw'>def</span> <span class='delete! fid id'>delete!</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span> <span class='rparen token'>)</span>
603
+ <span class='if if kw'>if</span> <span class='self self kw'>self</span><span class='lbrack token'>[</span><span class='name identifier id'>name</span><span class='rbrack token'>]</span>
604
+ <span class='file identifier id'>file</span> <span class='assign token'>=</span> <span class='delete identifier id'>delete</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span> <span class='rparen token'>)</span>
605
+ <span class='unless unless kw'>unless</span> <span class='document identifier id'>document</span><span class='dot token'>.</span><span class='new? fid id'>new?</span>
606
+ <span class='CouchDB constant id'>CouchDB</span><span class='dot token'>.</span><span class='delete identifier id'>delete</span><span class='lparen token'>(</span> <span class='uri_for identifier id'>uri_for</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span> <span class='rparen token'>)</span> <span class='rparen token'>)</span>
607
+ <span class='end end kw'>end</span>
608
+ <span class='file identifier id'>file</span>
609
+ <span class='end end kw'>end</span>
610
+ <span class='end end kw'>end</span>
611
+ </pre>
612
+ </td>
613
+ </tr>
614
+ </table>
615
+ </div>
616
+ </div>
617
+ </div>
618
+ </div>
619
+
620
+ <div class="method">
621
+ <div class="method_header">
622
+ <h3>get</h3>
623
+ </div><div id="get-instance_method" class="section method">
624
+ <div class="details_title">
625
+ <div class='section methodsignature'>
626
+ <tt class='def'>
627
+ <span class='visibility'>public</span>
628
+ <span class='return_types'><tt>File</tt></span>
629
+ <span class='name'>get</span><span class='args'>(name, stream = false)</span>
630
+ <span class='block'></span>
631
+ </tt>
632
+ </div>
633
+
634
+ </div><div class="section docstring">
635
+ <p>
636
+ Gets an attachment from the collection first. If not found, it will be
637
+ requested from the database.
638
+ </p>
639
+
640
+ </div><div class="section tags">
641
+ <h2>Meta Tags</h2>
642
+ <div class="return">
643
+ <h3>Returns:</h3>
644
+ <dl>
645
+
646
+ <dt>
647
+
648
+ <span class='type'>[<tt>File</tt>, <tt>nil</tt>]</span>
649
+
650
+
651
+ <span class='name'></span>
652
+
653
+
654
+ </dt>
655
+ <dd>
656
+ <span class='desc'><p>
657
+ File for that name, or nil if not found in hash or in database
658
+ </p>
659
+ </span>
660
+ </dd>
661
+
662
+ </dl>
663
+ </div>
664
+
665
+ </div><div class="section source">
666
+ <span>[<a class="source_link" href="#">View source</a>]</span>
667
+ <div class="source_code">
668
+ <table>
669
+ <tr>
670
+ <td>
671
+ <pre class="lines">
672
+
673
+
674
+ 83
675
+ 84
676
+ 85
677
+ 86
678
+ 87
679
+ 88
680
+ 89</pre>
681
+ </td>
682
+ <td>
683
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 83</span>
684
+
685
+ <span class='def def kw'>def</span> <span class='get identifier id'>get</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='stream identifier id'>stream</span><span class='assign token'>=</span><span class='false false kw'>false</span> <span class='rparen token'>)</span>
686
+ <span class='file identifier id'>file</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='lbrack token'>[</span><span class='name identifier id'>name</span><span class='rbrack token'>]</span>
687
+ <span class='unless unless kw'>unless</span> <span class='file identifier id'>file</span>
688
+ <span class='file identifier id'>file</span> <span class='assign token'>=</span> <span class='get! fid id'>get!</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='stream identifier id'>stream</span> <span class='rparen token'>)</span>
689
+ <span class='end end kw'>end</span>
690
+ <span class='file identifier id'>file</span>
691
+ <span class='end end kw'>end</span>
692
+ </pre>
693
+ </td>
694
+ </tr>
695
+ </table>
696
+ </div>
697
+ </div>
698
+ </div>
699
+ </div>
700
+
701
+ <div class="method">
702
+ <div class="method_header">
703
+ <h3>get!</h3>
704
+ </div><div id="get!-instance_method" class="section method">
705
+ <div class="details_title">
706
+ <div class='section methodsignature'>
707
+ <tt class='def'>
708
+ <span class='visibility'>public</span>
709
+ <span class='return_types'><tt>File</tt></span>
710
+ <span class='name'>get!</span><span class='args'>(name, stream = false)</span>
711
+ <span class='block'></span>
712
+ </tt>
713
+ </div>
714
+
715
+ </div><div class="section docstring">
716
+ <p>
717
+ Gets an attachment from the database. Stores it in the hash.
718
+ </p>
719
+
720
+ </div><div class="section tags">
721
+ <h2>Meta Tags</h2>
722
+ <div class="return">
723
+ <h3>Returns:</h3>
724
+ <dl>
725
+
726
+ <dt>
727
+
728
+ <span class='type'>[<tt>File</tt>, <tt>nil</tt>]</span>
729
+
730
+
731
+ <span class='name'></span>
732
+
733
+
734
+ </dt>
735
+ <dd>
736
+ <span class='desc'><p>
737
+ File for that name, or nil if not found in the database
738
+ </p>
739
+ </span>
740
+ </dd>
741
+
742
+ </dl>
743
+ </div>
744
+ <div class="raise">
745
+ <h3>Raises:</h3>
746
+ <dl>
747
+
748
+ <dt>
749
+
750
+ <span class='type'>[<tt>Object</tt>]</span>
751
+
752
+
753
+
754
+ </dt>
755
+ <dd>
756
+ <span class='desc'><p>
757
+ Any error encountered on retrieval of the attachment, json, http_client,
758
+ Aqua etc
759
+ </p>
760
+ </span>
761
+ </dd>
762
+
763
+ </dl>
764
+ </div>
765
+ <div class="todo">
766
+ <h3>Todo Item:</h3>
767
+ <ul>
768
+
769
+ <li><strong>make this more memory favorable, maybe streaming/saving in a max number of bytes</strong> </li>
770
+
771
+ </ul>
772
+ </div>
773
+ </div><div class="section source">
774
+ <span>[<a class="source_link" href="#">View source</a>]</span>
775
+ <div class="source_code">
776
+ <table>
777
+ <tr>
778
+ <td>
779
+ <pre class="lines">
780
+
781
+
782
+ 101
783
+ 102
784
+ 103
785
+ 104
786
+ 105
787
+ 106
788
+ 107
789
+ 108
790
+ 109
791
+ 110
792
+ 111
793
+ 112
794
+ 113</pre>
795
+ </td>
796
+ <td>
797
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 101</span>
798
+
799
+ <span class='def def kw'>def</span> <span class='get! fid id'>get!</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='stream identifier id'>stream</span><span class='assign token'>=</span><span class='false false kw'>false</span> <span class='rparen token'>)</span>
800
+ <span class='file identifier id'>file</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
801
+ <span class='response identifier id'>response</span> <span class='assign token'>=</span> <span class='CouchDB constant id'>CouchDB</span><span class='dot token'>.</span><span class='get identifier id'>get</span><span class='lparen token'>(</span> <span class='uri_for identifier id'>uri_for</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='false false kw'>false</span> <span class='rparen token'>)</span> <span class='rparen token'>)</span> <span class='rescue rescue kw'>rescue</span> <span class='nil nil kw'>nil</span>
802
+ <span class='data identifier id'>data</span> <span class='assign token'>=</span> <span class='Base64 constant id'>Base64</span><span class='dot token'>.</span><span class='decode64 identifier id'>decode64</span><span class='lparen token'>(</span> <span class='response identifier id'>response</span><span class='lbrack token'>[</span><span class='string val'>'data'</span><span class='rbrack token'>]</span> <span class='rparen token'>)</span> <span class='if if_mod kw'>if</span> <span class='response identifier id'>response</span>
803
+ <span class='if if kw'>if</span> <span class='data identifier id'>data</span>
804
+ <span class='file identifier id'>file</span> <span class='assign token'>=</span> <span class='Tempfile constant id'>Tempfile</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span> <span class='CGI constant id'>CGI</span><span class='dot token'>.</span><span class='escape identifier id'>escape</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span> <span class='rparen token'>)</span> <span class='rparen token'>)</span>
805
+ <span class='file identifier id'>file</span><span class='dot token'>.</span><span class='binmode identifier id'>binmode</span> <span class='if if_mod kw'>if</span> <span class='file identifier id'>file</span><span class='dot token'>.</span><span class='respond_to? fid id'>respond_to?</span><span class='lparen token'>(</span> <span class='symbol val'>:binmode</span> <span class='rparen token'>)</span>
806
+ <span class='file identifier id'>file</span><span class='dot token'>.</span><span class='write identifier id'>write</span><span class='lparen token'>(</span> <span class='data identifier id'>data</span> <span class='rparen token'>)</span>
807
+ <span class='file identifier id'>file</span><span class='dot token'>.</span><span class='rewind identifier id'>rewind</span>
808
+ <span class='self self kw'>self</span><span class='lbrack token'>[</span><span class='name identifier id'>name</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='file identifier id'>file</span>
809
+ <span class='end end kw'>end</span>
810
+ <span class='stream identifier id'>stream</span> <span class='integer val'>? </span><span class='file identifier id'>file</span><span class='dot token'>.</span><span class='read identifier id'>read</span> <span class='colon op'>:</span> <span class='file identifier id'>file</span>
811
+ <span class='end end kw'>end</span>
812
+ </pre>
813
+ </td>
814
+ </tr>
815
+ </table>
816
+ </div>
817
+ </div>
818
+ </div>
819
+ </div>
820
+
821
+ <div class="method">
822
+ <div class="method_header">
823
+ <h3>update_doc_rev</h3>
824
+ </div><div id="update_doc_rev-instance_method" class="section method">
825
+ <div class="details_title">
826
+ <div class='section methodsignature'>
827
+ <tt class='def'>
828
+ <span class='visibility'>public</span>
829
+ <span class='return_types'></span>
830
+ <span class='name'>update_doc_rev</span><span class='args'>(response)</span>
831
+ <span class='block'></span>
832
+ </tt>
833
+ </div>
834
+
835
+ </div><div class="section docstring">
836
+ <p>
837
+ Goes into the document and updates it&#8217;s rev to match the returned
838
+ rev. That way #new? will return false when an attachment is created before
839
+ the document is saved. It also means that future attempts to save the doc
840
+ won&#8217;t fail with a conflict.
841
+ </p>
842
+
843
+ </div><div class="section tags">
844
+ <h2>Meta Tags</h2>
845
+ <div class="param">
846
+ <h3>Parameters:</h3>
847
+ <dl>
848
+
849
+
850
+ <dt>
851
+ <span class='type'>[<tt><a href="../../../Hash.html" title="Hash">Hash</a></tt>]</span>
852
+ <span class='name'>response</span>
853
+
854
+ </dt>
855
+ <dd>
856
+ <span class='desc'><p>
857
+ from the put request
858
+ </p>
859
+ </span>
860
+ </dd>
861
+
862
+
863
+ </dl>
864
+ </div>
865
+ </div><div class="section source">
866
+ <span>[<a class="source_link" href="#">View source</a>]</span>
867
+ <div class="source_code">
868
+ <table>
869
+ <tr>
870
+ <td>
871
+ <pre class="lines">
872
+
873
+
874
+ 145
875
+ 146
876
+ 147</pre>
877
+ </td>
878
+ <td>
879
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 145</span>
880
+
881
+ <span class='def def kw'>def</span> <span class='update_doc_rev identifier id'>update_doc_rev</span><span class='lparen token'>(</span> <span class='response identifier id'>response</span> <span class='rparen token'>)</span>
882
+ <span class='document identifier id'>document</span><span class='lbrack token'>[</span><span class='symbol val'>:_rev</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='response identifier id'>response</span><span class='lbrack token'>[</span><span class='string val'>'rev'</span><span class='rbrack token'>]</span>
883
+ <span class='end end kw'>end</span>
884
+ </pre>
885
+ </td>
886
+ </tr>
887
+ </table>
888
+ </div>
889
+ </div>
890
+ </div>
891
+ </div>
892
+
893
+ <div class="method">
894
+ <div class="method_header">
895
+ <h3>uri_for</h3>
896
+ </div><div id="uri_for-instance_method" class="section method">
897
+ <div class="details_title">
898
+ <div class='section methodsignature'>
899
+ <tt class='def'>
900
+ <span class='visibility'>public</span>
901
+ <span class='return_types'></span>
902
+ <span class='name'>uri_for</span><span class='args'>(name, include_rev = true)</span>
903
+ <span class='block'></span>
904
+ </tt>
905
+ </div>
906
+
907
+ </div><div class="section docstring">
908
+ <p>
909
+ Constructs the standalone attachment uri for PUT and DELETE actions.
910
+ </p>
911
+
912
+ </div><div class="section tags">
913
+ <h2>Meta Tags</h2>
914
+ <div class="raise">
915
+ <h3>Raises:</h3>
916
+ <dl>
917
+
918
+ <dt>
919
+
920
+ <span class='type'>[<tt>ArgumentError</tt>]</span>
921
+
922
+
923
+
924
+ </dt>
925
+ <dd>
926
+ <span class='desc'></span>
927
+ </dd>
928
+
929
+ </dl>
930
+ </div>
931
+
932
+ </div><div class="section source">
933
+ <span>[<a class="source_link" href="#">View source</a>]</span>
934
+ <div class="source_code">
935
+ <table>
936
+ <tr>
937
+ <td>
938
+ <pre class="lines">
939
+
940
+
941
+ 120
942
+ 121
943
+ 122
944
+ 123</pre>
945
+ </td>
946
+ <td>
947
+ <pre class="code"><span class="info file"># File 'lib/aqua/store/couch_db/attachments.rb', line 120</span>
948
+
949
+ <span class='def def kw'>def</span> <span class='uri_for identifier id'>uri_for</span><span class='lparen token'>(</span> <span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='include_rev identifier id'>include_rev</span> <span class='assign token'>=</span> <span class='true true kw'>true</span> <span class='rparen token'>)</span>
950
+ <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>'Document must have id in order to save an attachment'</span> <span class='if if_mod kw'>if</span> <span class='document identifier id'>document</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span> <span class='orop op'>||</span> <span class='document identifier id'>document</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span>
951
+ <span class='document identifier id'>document</span><span class='dot token'>.</span><span class='uri identifier id'>uri</span> <span class='plus op'>+</span> <span class='dstring node'>&quot;/#{CGI.escape( name.to_s )}&quot;</span> <span class='plus op'>+</span> <span class='lparen token'>(</span> <span class='document identifier id'>document</span><span class='dot token'>.</span><span class='rev identifier id'>rev</span> <span class='andop op'>&amp;&amp;</span> <span class='include_rev identifier id'>include_rev</span> <span class='integer val'>? </span><span class='dstring node'>&quot;?rev=#{document.rev}&quot;</span> <span class='colon op'>:</span> <span class='string val'>&quot;&quot;</span> <span class='rparen token'>)</span>
952
+ <span class='end end kw'>end</span>
953
+ </pre>
954
+ </td>
955
+ </tr>
956
+ </table>
957
+ </div>
958
+ </div>
959
+ </div>
960
+ </div>
961
+
962
+ </div>
963
+ </div>
964
+
965
+ </div>
966
+ </div>
967
+ <div id="yard_info">
968
+ Generated on Monday, August 31 2009 at 03:23:18 PM by
969
+ <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
970
+ 0.2.3.5 (ruby-1.8.6).
971
+ </div>
972
+
973
+ </body>
974
+ </html>