Sha256: ac4b2750bb0b99fa660ea9ce3dbfa57c229145b29d5537ef21e2d3a1f2f4ac81

Contents?: true

Size: 702 Bytes

Versions: 6

Compression:

Stored size: 702 Bytes

Contents

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

module Glimmer
  module XML
    module CommandHandlers
      class XmlCommandHandler
        include CommandHandler

        def can_handle?(parent, command_symbol, *args, &block)
          (parent == nil or parent.is_a?(Node)) and
          (args.size == 0 or ((args.size == 1) and ((args[0].is_a?(Hash)) or (args[0].is_a?(Hash)))))
        end

        def do_handle(parent, command_symbol, *args, &block)
          attributes = Hash.new
          attributes = args[0] if (args.size == 1)
          Node.new(parent, command_symbol.to_s, attributes, &block)
        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_command_handler.rb
glimmer-0.4.8 lib/glimmer/xml/command_handlers/xml_command_handler.rb
glimmer-0.4.7 lib/glimmer/xml/command_handlers/xml_command_handler.rb
glimmer-0.4.6 lib/glimmer/xml/command_handlers/xml_command_handler.rb
glimmer-0.4.5 lib/glimmer/xml/command_handlers/xml_command_handler.rb
glimmer-0.4.4 lib/glimmer/xml/command_handlers/xml_command_handler.rb