Class: XmlNameSpaceCommandHandler
- Inherits:
-
Object
- Object
- XmlNameSpaceCommandHandler
- Includes:
- CommandHandler, Glimmer
- Defined in:
- lib/xml_command_handlers/xml_name_space_command_handler.rb
Instance Method Summary collapse
- #can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean
- #do_handle(parent, command_symbol, *args, &block) ⇒ Object
Methods included from Glimmer
#add_contents, add_contents, dsl, #dsl, extended, included, logger, #method_missing, method_missing
Methods included from SwtPackages
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Glimmer
Instance Method Details
#can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean
9 10 11 12 13 14 15 |
# File 'lib/xml_command_handlers/xml_name_space_command_handler.rb', line 9 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 |
#do_handle(parent, command_symbol, *args, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/xml_command_handlers/xml_name_space_command_handler.rb', line 17 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) Glimmer.logger.debug 'block' #NOOP end end parent.children << node if parent and !parent.children.include?(node) node end |