Sha256: dc36bfbfa4b8696c87e0f37cbaf0792c93583cafcc714d19c952451c66085a70

Contents?: true

Size: 602 Bytes

Versions: 4

Compression:

Stored size: 602 Bytes

Contents

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

module Glimmer
  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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
glimmer-0.4.3 lib/glimmer/xml_command_handlers/xml_command_handler.rb
glimmer-0.4.2 lib/glimmer/xml_command_handlers/xml_command_handler.rb
glimmer-0.4.1 lib/glimmer/xml_command_handlers/xml_command_handler.rb
glimmer-0.4.0 lib/glimmer/xml_command_handlers/xml_command_handler.rb