module PSD::EngineData::DocumentHelpers
A collection of helper methods that are used to manipulate the internal data structure while parsing.
Public Instance Methods
reset_node()
click to toggle source
Creates a new node
# File lib/psd/enginedata/document_helpers.rb, line 26 def reset_node @node = Node.new end
set_node(node)
click to toggle source
Sets the current active node
# File lib/psd/enginedata/document_helpers.rb, line 21 def set_node(node) @node = node end
set_property(property = nil)
click to toggle source
Sets the current active property
# File lib/psd/enginedata/document_helpers.rb, line 31 def set_property(property = nil) @property = property end
stack_pop()
click to toggle source
Pops a property and node from the parsing stack
# File lib/psd/enginedata/document_helpers.rb, line 16 def stack_pop return @property_stack.pop, @node_stack.pop end
stack_push(property = nil, node = nil)
click to toggle source
Pushes a property and node onto the parsing stack.
# File lib/psd/enginedata/document_helpers.rb, line 7 def stack_push(property = nil, node = nil) node = @node if node.nil? property = @property if property.nil? @node_stack.push node @property_stack.push property end
update_node(property, node)
click to toggle source
Updates a node with a given property and child node.
# File lib/psd/enginedata/document_helpers.rb, line 36 def update_node(property, node) if node.is_a?(PSD::EngineData::Node) node[property] = @node elsif node.is_a?(Array) node.push @node end end