class ReDuxml::ResolverClass
Constants
- COND_ATTR_NAME
- REF_ATTR_NAME
Attributes
cursor_stack[R]
dead[R]
e[R]
Public Class Methods
new(logic)
click to toggle source
@param doc [Ox::Document] document that is being constructed as XML is parsed @param _observer [Object] object that will observe this document's content
# File lib/re_dux.rb, line 19 def initialize(logic) @cursor_stack = [] @e = ReDuxml::Evaluator.new(logic) end
Public Instance Methods
attr(name, val)
click to toggle source
# File lib/re_dux.rb, line 34 def attr(name, val) cursor[name] = val end
cursor()
click to toggle source
# File lib/re_dux.rb, line 24 def cursor @cursor_stack.last end
end_element(name)
click to toggle source
# File lib/re_dux.rb, line 42 def end_element(name) case when cursor.if? cursor.remove_attribute(COND_ATTR_NAME) when cursor.respond_to?(:instantiate) # target = cursor.instantiate # target likely plural @cursor_stack[-2].replace(cursor, target) when cursor.ref? # target = resolve_ref @cursor_stack[-2].replace(cursor, target) cursor.remove_attribute(REF_ATTR_NAME) else @cursor_stack[-2].remove(cursor) return end @cursor_stack.pop end
start_element(name)
click to toggle source
# File lib/re_dux.rb, line 28 def start_element(name) new_el = Duxml::Element.new(name, line, column) cursor << new_el unless cursor.nil? @cursor_stack << new_el end
text(str)
click to toggle source
# File lib/re_dux.rb, line 38 def text(str) cursor << str end