lib/ruby_speech/ssml/element.rb in ruby_speech-0.1.0 vs lib/ruby_speech/ssml/element.rb in ruby_speech-0.1.1
- old
+ new
@@ -8,11 +8,12 @@
new_node << block_return if block_return.is_a?(String)
end
end
def method_missing(method_name, *args, &block)
- const = SSML.const_get(method_name.to_s.titleize.gsub(' ', ''))
- if const && self.valid_child_type?(const)
+ 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)
self << const.new(*args, &block)
else
super
end
end