class LANSA::XML::TransformerDelegator
Public Class Methods
new(delegate)
click to toggle source
Calls superclass method
# File xml/transformer.rb, line 560 def initialize delegate super @initial_delegate = delegate @current_delegate = nil @depth = -1 @delegate_depth = nil end
Public Instance Methods
delegator_intercept_end_element(*args)
click to toggle source
# File xml/transformer.rb, line 606 def delegator_intercept_end_element *args active_delegate = @current_delegate || @initial_delegate active_delegate.intercept_end_element *args # Set delegate back to initial when delegated depth is reached if @current_delegate and @delegate_depth == @depth @current_delegate.end @current_delegate = nil __setobj__(@initial_delegate) @delegate_depth = nil end @depth -= 1 end
Also aliased as: intercept_end_element
delegator_intercept_start_element(*args)
click to toggle source
# File xml/transformer.rb, line 568 def delegator_intercept_start_element *args # Increment 'depth' first @depth += 1 active_delegate = @current_delegate || @initial_delegate if @current_delegate.nil? # Add 'depth' as new last parameter to 'find_delegate' and thus 'start?'! find_delegate_args = args.dup find_delegate_args << @depth # Find a 'matching' delegate. # Note that if none is found, we would call the 'intercept' methods # on the initial transformer anyway! delegate = active_delegate.find_delegate(*find_delegate_args) # If a delegate is found - and actually different from the active one # set it as the current delegate if not delegate.nil? and delegate != active_delegate @current_delegate = delegate @current_delegate.start __setobj__(@current_delegate) @delegate_depth = @depth active_delegate = @current_delegate end end active_delegate.intercept_start_element *args end
Also aliased as: intercept_start_element