Module: TaliaCore::ActiveSourceParts::Xml::GenericReaderImportStatements::Handlers

Included in:
TaliaCore::ActiveSourceParts::Xml::GenericReader
Defined in:
lib/talia_core/active_source_parts/xml/generic_reader_import_statements.rb

Overview

Methods to create handlers. See GenericReaderImportStatements

Instance Method Summary collapse

Instance Method Details

#element(element_name, &handler_block) ⇒ Object

Creates a handler for the element_name tag. Each time the handler is called, a new, empty source is created and set as current.

The handler block will be executed as an instance method on the current reader object and the “current” XML inside the handler block will be the inner XML of the “element_name” tag that is currently being processed



129
130
131
# File 'lib/talia_core/active_source_parts/xml/generic_reader_import_statements.rb', line 129

def element(element_name, &handler_block)
  element_handler(element_name, true, &handler_block)
end

#plain_element(element_name, &handler_block) ⇒ Object

Works as #element, except that no new source is created. The current source in the block will be the one that is active at the point where the handler was called.



136
137
138
# File 'lib/talia_core/active_source_parts/xml/generic_reader_import_statements.rb', line 136

def plain_element(element_name, &handler_block)
  element_handler(element_name, false, &handler_block)
end