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



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

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



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

def build
 ['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