Class: BootstrapEmail::Converter::Align

Inherits:
Base
  • Object
show all
Defined in:
lib/bootstrap-email/converters/align.rb

Instance Attribute Summary

Attributes inherited from Base

#doc

Instance Method Summary collapse

Methods inherited from Base

build, #initialize

Constructor Details

This class inherits a constructor from BootstrapEmail::Converter::Base

Instance Method Details

#align_helper(node, full_type, type) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/bootstrap-email/converters/align.rb', line 15

def align_helper(node, full_type, type)
  unless table?(node) || td?(node)
    node['class'] = node['class'].sub(full_type, '').strip
    node = node.replace(template('table', classes: full_type, contents: node.to_html))[0]
  end
  node['align'] = type
end

#buildObject



6
7
8
9
10
11
12
13
# File 'lib/bootstrap-email/converters/align.rb', line 6

def build
  %w[left center right].each do |type|
    full_type = "ax-#{type}"
    each_node(".#{full_type}") do |node|
      align_helper(node, full_type, type)
    end
  end
end