Method: LOLspeak::Tranzlator#translate_xml_string
- Defined in:
- lib/lolspeak.rb
#translate_xml_string(xml_string, &filter) ⇒ Object
Translates the text parts of a well-formed XML string. It parses the string using REXML and then translates the root element using translate_xml_element_recursive!.
If a block is given, it is called to transform each individual word.
:call-seq:
translate_xml_string(xml_string) -> String
translate_xml_string(xml_string) { |word| transform } -> String
199 200 201 202 203 |
# File 'lib/lolspeak.rb', line 199 def translate_xml_string(xml_string, &filter) xml_doc = REXML::Document.new xml_string translate_xml_element_recursive!(xml_doc, &filter) return xml_doc.to_s end |