Sha256: f38f4e9d0bf89141c8a8ab383074d7d0f501bd864ec1512b725133187eccfb8b

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

require File.dirname(__FILE__) + "/../../command_handler"
require File.dirname(__FILE__) + "/../node"
require File.dirname(__FILE__) + "/../depth_first_search_iterator"
require File.dirname(__FILE__) + "/../name_space_visitor"

module Glimmer
  module XML
    module CommandHandlers
      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)
              Glimmer.logger.debug 'block'
              #NOOP
            end
          end
          parent.children << node if parent and !parent.children.include?(node)
          node
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
glimmer-0.4.9 lib/glimmer/xml/command_handlers/xml_name_space_command_handler.rb
glimmer-0.4.8 lib/glimmer/xml/command_handlers/xml_name_space_command_handler.rb
glimmer-0.4.7 lib/glimmer/xml/command_handlers/xml_name_space_command_handler.rb
glimmer-0.4.6 lib/glimmer/xml/command_handlers/xml_name_space_command_handler.rb
glimmer-0.4.5 lib/glimmer/xml/command_handlers/xml_name_space_command_handler.rb
glimmer-0.4.4 lib/glimmer/xml/command_handlers/xml_name_space_command_handler.rb