lib/bootstrap-email/components/align.rb in bootstrap-email-1.0.0.alpha1.2 vs lib/bootstrap-email/components/align.rb in bootstrap-email-1.0.0.alpha2

- old
+ new

@@ -1,19 +1,20 @@ module BootstrapEmail module Component class Align < Base def build ['left', 'center', 'right'].each do |type| - each_node(".align-#{type}") do |node| - align_helper(node, type) + full_type = "align-#{type}" + each_node(".#{full_type}") do |node| + align_helper(node, full_type, type) end end end - def align_helper(node, type) - if node.name != 'table' - node['class'] = node['class'].sub("align-#{type}", '') - node = node.replace(template('table', classes: "align-#{type}", contents: node.to_html))[0] + def align_helper(node, full_type, type) + unless table?(node) || td?(node) + node['class'] = node['class'].sub(full_type, '') + node = node.replace(template('table', classes: full_type, contents: node.to_html))[0] end node['align'] = type end end end