public
Description: StrokeDB is an embeddable distributed document database written in Ruby
Homepage: http://strokedb.com/
Clone URL: git://github.com/yrashk/strokedb.git
added some comment to a view for index_slots.rb
oleganza (author)
Thu May 01 12:15:47 -0700 2008
commit  f543d0effa827695f36487c17024f8b46ac8e130
tree    e27da68955e8f62325fe65c8990346b921182312
parent  8c24572711a8b960f2b61f28e47412475b69e43d
...
7
8
9
 
 
10
 
11
12
13
...
15
16
17
 
18
 
19
20
21
...
7
8
9
10
11
12
13
14
15
16
...
18
19
20
21
22
23
24
25
26
0
@@ -7,7 +7,10 @@ module StrokeDB
0
     #   end
0
     #
0
     def index_slots(*args)
0
+      # Wrap all slots into an array:
0
+      # [:a, :b, [:x, :y]]  => [ [:a], [:b], [:x, :y] ]
0
       slots = args.map{|a| a.is_a?(Array) ? a.map{|e|e.to_s} : [a.to_s] }
0
+      
0
       @meta_initialization_procs << Proc.new do
0
         view_name = "index_slots_for_#{name}:#{nsurl}"
0
         opts = { :only => name, :slots => slots, :doc_meta => doc }
0
@@ -15,7 +18,9 @@ module StrokeDB
0
           def view.map(uuid, doc)
0
             meta = self['doc_meta']
0
             slots.each do |sl|
0
+              # construct a key out of the list of slots
0
               k = sl.inject([]) do |a, sn|
0
+                # push [slot_name, slot_value]
0
                 a << sn << doc[sn]
0
               end
0
               [[meta, k], doc]

Comments