Permalink
Browse files

nil

  • Loading branch information...
1 parent 2847fcf commit 3af9755aadc5ad6c11de14a4a61d4eba63ba1502 @mikisvaz committed May 7, 2012
Showing with 9 additions and 7 deletions.
  1. +9 −7 lib/rbbt/entity/document.rb
@@ -7,32 +7,34 @@ class << self
attr_accessor :corpus
end
- property :text => :array2single do
+ property :text => :array2single do |*args|
article_text = {}
missing = []
if Document.corpus.nil?
- self._get_text
+ self._get_text(*args)
else
self.each do |doc|
+ doc_code = args.any? ? [doc, Misc.digest(args.inspect)] * ":" : doc
Document.corpus.read if Document.corpus.respond_to? :read
if Document.corpus.include?(doc)
- article_text[doc] = Document.corpus[doc]
+ article_text[doc_code] = Document.corpus[doc_code]
else
missing << doc
end
end
if missing.any?
missing.first.annotate missing
- missing_text = Misc.process_to_hash(missing){|list| list._get_text}
+ missing_text = Misc.process_to_hash(missing){|list| list._get_text(*args)}
- Misc.lock Document.corpus.persistence_path do
+ Misc.lock(Document.corpus.respond_to?(:persistence_path) ? Document.corpus.persistence_path : nil) do
Document.corpus.write if Document.corpus.respond_to? :write
missing_text.each do |doc, text|
- article_text[doc] = text
- Document.corpus[doc] = text
+ doc_code = args.any? ? [doc, Misc.digest(args.inspect)] * ":" : doc
+ article_text[doc_code] = text
+ Document.corpus[doc_code] = text
end
Document.corpus.read if Document.corpus.respond_to? :read
end

0 comments on commit 3af9755

Please sign in to comment.