module ConDuxml::Instance
Instances are copies of another XML element with a distinct set of parameter values like Objects in relation to a Class
Public Instance Methods
activate()
click to toggle source
@return [Array[Element, String]] array (or NodeSet) of either shallow clone of child nodes or referenced nodes @see ref=
# File lib/con_duxml/instance.rb, line 28 def activate [resolve_ref || nodes].flatten.clone end
ref=(target)
click to toggle source
@param target [String] path to target node or file @return [Element] self
# File lib/con_duxml/instance.rb, line 10 def ref=(target) raise Exception unless doc.locate(target) or File.exists?(target) self[:ref] = target end
resolve_ref(attr='ref')
click to toggle source
@return [Element] either root node of referenced Doc or referenced node
# File lib/con_duxml/instance.rb, line 16 def resolve_ref(attr='ref') source = if self[:file] path = File.expand_path(File.dirname(doc.path) + '/' + self[:file]) sax path else doc end return source.locate(self[attr]).first if self[attr] source.root if self[:file] end