Sha256: cbe92c15dd5a5c6625c929f547a2a2790b604aedd83a64bdd5ce81040ddf40e6
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
# Copyright (C) 2007-2008 Annas Al Maleh # Licensed under the LGPL. See /COPYING.LGPL for more details. require File.dirname(__FILE__) + "/../command_handler" require File.dirname(__FILE__) + "/models/node" require File.dirname(__FILE__) + "/models/depth_first_search_iterator" require File.dirname(__FILE__) + "/models/name_space_visitor" class XmlNameSpaceCommandHandler include CommandHandler, Glimmer def can_handle?(parent, command_symbol, *args, &block) (parent == nil or parent.is_a?(Node)) and (command_symbol.to_s == "name_space") (args.size == 1) and (args[0].is_a?(Symbol)) and block end def do_handle(parent, command_symbol, *args, &block) node = block.call unless node.is_a?(String) name_space_visitor = NameSpaceVisitor.new(args[0].to_s) DepthFirstSearchIterator.new(node, name_space_visitor).iterate def node.process_block(block) puts 'block' #NOOP end end parent.children << node if parent and !parent.children.include?(node) node end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
glimmer-0.1.0.0 | src/xml_command_handlers/xml_name_space_command_handler.rb |