Module: Transform
Overview
All public methods can be invoked by a transform element; please hide methods you don’t want users to invoke in Private
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#content(node) ⇒ Array[String, Element]
Array of child nodes of target.
-
#copy(path) ⇒ Element
A deep copy of the target(s).
-
#element(*args) ⇒ Element
New element to replace old one.
-
#find_source(node) ⇒ Element
XML node that provided content for transformation i.e.
-
#find_transform(node) ⇒ Element
XML node that contains instructions for transform used to create given @param node.
-
#find_xform_event(node) ⇒ TransformClass
Transform event object from output Doc’s history.
Methods included from Private
#activate, #add_name_space_prefix, #get_args, #get_method, #get_sources, #normalize_arg, #separate_enumerables
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
16 17 18 |
# File 'lib/con_duxml/transform.rb', line 16 def source @source end |
Instance Method Details
#content(node) ⇒ Array[String, Element]
Returns array of child nodes of target.
38 39 40 |
# File 'lib/con_duxml/transform.rb', line 38 def content(node) node.respond_to?(:nodes) ? node.nodes : node end |
#copy(path) ⇒ Element
Returns a deep copy of the target(s).
51 52 53 54 55 |
# File 'lib/con_duxml/transform.rb', line 51 def copy(path) @source.locate(add_name_space_prefix path).collect do |node| node.dclone end end |
#element(*args) ⇒ Element
Returns new element to replace old one.
45 46 47 |
# File 'lib/con_duxml/transform.rb', line 45 def element(*args) Element.new(*args) end |
#find_source(node) ⇒ Element
Returns XML node that provided content for transformation i.e. source.
32 33 34 |
# File 'lib/con_duxml/transform.rb', line 32 def find_source(node) find_xform_event(node).input end |
#find_transform(node) ⇒ Element
Returns XML node that contains instructions for transform used to create given @param node.
26 27 28 |
# File 'lib/con_duxml/transform.rb', line 26 def find_transform(node) find_xform_event(node).instructions end |
#find_xform_event(node) ⇒ TransformClass
Returns transform event object from output Doc’s history.
20 21 22 |
# File 'lib/con_duxml/transform.rb', line 20 def find_xform_event(node) @output.history #TODO find transform whose outputs include given node end |