lib/ruby_speech/ssml/element.rb in ruby_speech-0.2.0 vs lib/ruby_speech/ssml/element.rb in ruby_speech-0.2.1
- old
+ new
@@ -35,12 +35,13 @@
# Looks up the class the node should be then creates it based on the
# elements of the XML::Node
# @param [XML::Node] node the node to import
# @return the appropriate object based on the node name and namespace
def self.import(node)
+ return node.content if node.is_a?(Nokogiri::XML::Text)
klass = class_from_registration(node.element_name)
- event = if klass && klass != self
+ if klass && klass != self
klass.import node
else
new.inherit node
end
end
@@ -64,10 +65,10 @@
new_node << new_node.encode_special_chars(block_return) if block_return.is_a?(String)
end
end
def children
- super.reject { |c| c.is_a?(Nokogiri::XML::Text) }.map { |c| Element.import c }
+ super.map { |c| Element.import c }
end
def method_missing(method_name, *args, &block)
const_name = method_name.to_s.sub('ssml', '').titleize.gsub(' ', '')
const = SSML.const_get const_name