Class: XmlTextCommandHandler

Inherits:
Object
  • Object
show all
Includes:
CommandHandler
Defined in:
lib/xml_command_handlers/xml_text_command_handler.rb

Instance Method Summary collapse

Instance Method Details

#can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean



7
8
9
10
11
12
# File 'lib/xml_command_handlers/xml_text_command_handler.rb', line 7

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

#do_handle(parent, command_symbol, *args, &block) ⇒ Object



14
15
16
17
# File 'lib/xml_command_handlers/xml_text_command_handler.rb', line 14

def do_handle(parent, command_symbol, *args, &block)
  parent.children << args[0] if parent
  args[0]
end