lib/ruby_speech/ssml/element.rb in ruby_speech-0.3.0 vs lib/ruby_speech/ssml/element.rb in ruby_speech-0.3.1

- old
+ new

@@ -57,13 +57,24 @@ end self end def self.new(element_name, atts = {}, &block) - super(element_name) do |new_node| + blk_proc = lambda do |new_node| atts.each_pair { |k, v| new_node.send :"#{k}=", v } block_return = new_node.instance_eval &block if block_given? new_node << new_node.encode_special_chars(block_return) if block_return.is_a?(String) + end + + case RUBY_VERSION.split('.')[0,2].join.to_i + when 18 + super(element_name).tap do |n| + blk_proc[n] + end + else + super(element_name) do |n| + blk_proc[n] + end end end def children super.map { |c| Element.import c }