Skip to content

Commit

Permalink
Meta#implements will save metas implemented to 'metas_implemented' sl…
Browse files Browse the repository at this point in the history
…ot in a metadocument
  • Loading branch information
Yurii Rashkovskii committed May 16, 2008
1 parent 89185ac commit 74b909b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/strokedb/document/meta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ def uuid
end

def implements(another_meta)
values = @args.select{|a| a.is_a?(Hash) }.first
values = @args.find{|a| a.is_a?(Hash) }
values.merge!(another_meta.document.to_raw.delete_if {|k,v| ['name','uuid','version','previous_version','meta'].member?(k) })
values[:implements_metas] ||= []
values[:implements_metas] << another_meta.document
include(another_meta)
self
end
Expand Down
7 changes: 7 additions & 0 deletions spec/lib/strokedb/document/meta_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ def implements_some_name_meta
ImplementsSomeName.name.should == "ImplementsSomeName"
end

it "should reference implemented meta" do
ImplementsSomeName.document.implements_metas.should == [SomeName.document]
end


end

Expand Down Expand Up @@ -362,6 +366,9 @@ def implements_some_name_meta
ImplementsSomeName.name.should == "ImplementsSomeName"
end

it "should reference implemented metas" do
ImplementsSomeName.document.implements_metas.to_set.should == [SomeName.document,SomeName1.document].to_set
end

end

Expand Down

0 comments on commit 74b909b

Please sign in to comment.