Skip to content

Commit

Permalink
added meta_initialization proc
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Andreev committed Apr 30, 2008
1 parent 3e40ce0 commit 8c24572
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/strokedb/document/index_slots.rb
Expand Up @@ -8,17 +8,18 @@ module IndexSlots
#
def index_slots(*args)
slots = args.map{|a| a.is_a?(Array) ? a.map{|e|e.to_s} : [a.to_s] }
view_name = "index_slots_for_#{name}:#{nsurl}"
doc = document # metadocument
opts = { :only => name, :slots => slots, :doc_meta => doc }
doc.index_slots_view = View.define!(view_name, opts) do |view|
def view.map(uuid, doc)
meta = self['doc_meta']
slots.each do |sl|
k = sl.inject([]) do |a, sn|
a << sn << doc[sn]
@meta_initialization_procs << Proc.new do
view_name = "index_slots_for_#{name}:#{nsurl}"
opts = { :only => name, :slots => slots, :doc_meta => doc }
doc.index_slots_view = View.define!(view_name, opts) do |view|
def view.map(uuid, doc)
meta = self['doc_meta']
slots.each do |sl|
k = sl.inject([]) do |a, sn|
a << sn << doc[sn]
end
[[meta, k], doc]
end
[[meta, k], doc]
end
end
end
Expand Down

0 comments on commit 8c24572

Please sign in to comment.