lib/ruby_speech/ssml/element.rb in ruby_speech-0.2.1 vs lib/ruby_speech/ssml/element.rb in ruby_speech-0.2.2
- old
+ new
@@ -68,9 +68,24 @@
def children
super.map { |c| Element.import c }
end
+ def embed(other)
+ case other
+ when String
+ self << encode_special_chars(other)
+ when Speak
+ other.children.each do |child|
+ self << child
+ end
+ when Element
+ self << other
+ else
+ raise ArgumentError, "Can only embed a String or an SSML element"
+ end
+ end
+
def method_missing(method_name, *args, &block)
const_name = method_name.to_s.sub('ssml', '').titleize.gsub(' ', '')
const = SSML.const_get const_name
if const && self.class::VALID_CHILD_TYPES.include?(const)
if const == String