Class: XmlCommandHandler
- Inherits:
-
Object
- Object
- XmlCommandHandler
- Includes:
- CommandHandler
- Defined in:
- lib/xml_command_handlers/xml_command_handler.rb
Instance Method Summary collapse
- #can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean
- #do_handle(parent, command_symbol, *args, &block) ⇒ Object
Instance Method Details
#can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean
7 8 9 10 |
# File 'lib/xml_command_handlers/xml_command_handler.rb', line 7 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 |
#do_handle(parent, command_symbol, *args, &block) ⇒ Object
12 13 14 15 16 |
# File 'lib/xml_command_handlers/xml_command_handler.rb', line 12 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 |