lib/rbbt/association/item.rb in rbbt-util-5.16.3 vs lib/rbbt/association/item.rb in rbbt-util-5.17.0
- old
+ new
@@ -1,9 +1,9 @@
require 'rbbt/entity'
module AssociationItem
- extend Entity
+ extend Object::Entity
annotation :knowledge_base
annotation :database
annotation :reverse
@@ -13,14 +13,24 @@
property :full_name => :single do
database ? [database, name] * ":" : name
end
- property :invert => :single do
- s,_sep,t= self.partition "~"
- inverted = self.annotate([t,s] * _sep)
- inverted.reverse = ! reverse
- inverted
+ property :invert => :both do
+ if Array === self
+ inverted = self.collect do |item|
+ s,_sep,t= item.partition "~"
+ new = [t,s] * _sep
+ end
+ self.annotate inverted
+ inverted.reverse = ! reverse
+ inverted
+ else
+ s,_sep,t= self.partition "~"
+ inverted = self.annotate([t,s] * _sep)
+ inverted.reverse = ! reverse
+ inverted
+ end
end
property :namespace => :both do
knowledge_base.namespace
end