Module: ConDuxml
- Defined in:
- lib/con_duxml.rb,
lib/con_duxml/link.rb,
lib/con_duxml/array.rb,
lib/con_duxml/instance.rb
Defined Under Namespace
Modules: Array, Instance, Link Classes: InstanceClass
Instance Attribute Summary collapse
-
#src_ns ⇒ Object
readonly
Returns the value of attribute src_ns.
Attributes included from Transform
Instance Method Summary collapse
-
#instantiate(source) ⇒ Doc
instantiation takes a static design file and constructs a dynamic model by identifying certain keyword elements, executing their method on child nodes, then removing the interpolating keyword element.
-
#transform(transforms, doc_or_path = nil) ⇒ Doc
Result of transform; automatically hashed into @transforms.
Methods included from Transform
#content, #copy, #element, #find_source, #find_transform, #find_xform_event
Methods included from Private
#activate, #add_name_space_prefix, #get_args, #get_method, #get_sources, #normalize_arg, #separate_enumerables
Instance Attribute Details
#src_ns ⇒ Object (readonly)
Returns the value of attribute src_ns.
11 12 13 |
# File 'lib/con_duxml.rb', line 11 def src_ns @src_ns end |
Instance Method Details
#instantiate(source) ⇒ Doc
instantiation takes a static design file and constructs a dynamic model by identifying certain keyword elements, executing their method on child nodes, then removing the interpolating keyword element. these are:
<array> - is replaced by multiple copies of its direct child or referenced XML nodes, allowing for user-defined variations between each copy <instance> - when it contains design elements, it is removed but its reference ID is given to all children creating an XML-invisible arbitrary grouping
when it references an XML file, ID or path to an XML element, the target is copied and inserted in place of this element
<link> - referenced XML file or nodes provides namespace, contents, and notification of changes to any direct children of this node @see ConDuxml::Link
48 49 50 |
# File 'lib/con_duxml.rb', line 48 def instantiate(source) end |
#transform(transforms, doc_or_path = nil) ⇒ Doc
Returns result of transform; automatically hashed into @transforms.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/con_duxml.rb', line 17 def transform(transforms, doc_or_path=nil) @output = Doc.new transforms = case transforms when Doc then transforms.root when Element then transforms when String then sax(transforms).root else end @doc = case doc_or_path when Doc then doc_or_path when String then sax doc_or_path else doc end @src_ns = transforms[:src_ns] source = doc.locate(add_name_space_prefix(transforms[:source])).first @output.grammar = transforms[:grammar] if transforms[:grammar] add_observer @output.history a = activate(transforms.first, source).first @output << a end |