Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/witlessbird/strokedb

  • Loading branch information...
commit 75b660e1520a646ff028dcce34abf6fd4c880820 2 parents 70bd2f5 + 6e50edd
Yurii Rashkovskii authored
Showing with 4 additions and 15 deletions.
  1. +4 −15 lib/strokedb/document.rb
View
19 lib/strokedb/document.rb
@@ -110,7 +110,7 @@ def delete(meta)
case meta
when Document
_delete meta
- _module = StrokeDB::Document.collect_meta_modules(@document.store, meta).first
+ _module = MetaModulesCollector.new(@document.store, meta).collect!.first
when Meta
_delete meta.document(@document.store)
_module = meta
@@ -134,7 +134,7 @@ def add_meta(meta, opts = {})
case meta
when Document
push meta
- _module = StrokeDB::Document.collect_meta_modules(@document.store, meta).first
+ _module = MetaModulesCollector.new(@document.store, meta).collect!.first
when Meta
push meta.document(@document.store)
_module = meta
@@ -342,7 +342,7 @@ def to_optimized_raw #:nodoc:
def self.from_raw(store, raw_slots, opts = {}, &block) #:nodoc:
doc = new(store, raw_slots, true, &block)
- collect_meta_modules(store, raw_slots[Meta.meta_uuid]).each do |meta_module|
+ MetaModulesCollector.new(store, raw_slots[Meta.meta_uuid]).collect!.each do |meta_module|
unless doc.is_a? meta_module
doc.extend(meta_module)
end
@@ -715,7 +715,7 @@ def collect!
meta_names << @subject[:name]
end
- meta_names
+ meta_names.map { |m| m.is_a?(String) ? (m.constantize rescue nil) : m }.compact
end
def lookup_version_for_meta(meta)
@@ -739,17 +739,6 @@ def has_meta_definition?(mod, metadoc)
end
end
-
-
- # returns an array of meta modules (as constants) for a given something
- # (a document reference, a document itself, or an array of the former)
- def self.collect_meta_modules(store, meta) #:nodoc:
- @collector = MetaModulesCollector.new(store, meta)
- meta_names = @collector.collect!
-
- meta_names.map { |m| m.is_a?(String) ? (m.constantize rescue nil) : m }.compact
- end
-
def generate_new_version!
self.version = Util.random_uuid
end
Please sign in to comment.
Something went wrong with that request. Please try again.