Class: BootstrapEmail::Converter::Stack

Inherits:
Base
  • Object
show all
Defined in:
lib/bootstrap-email/converters/stack.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

#buildObject



6
7
8
9
# File 'lib/bootstrap-email/converters/stack.rb', line 6

def build
  stack_row
  stack_col
end

#stack_colObject



21
22
23
24
25
26
27
28
29
# File 'lib/bootstrap-email/converters/stack.rb', line 21

def stack_col
  each_node('.stack-col') do |node|
    html = ''
    node.xpath('./*').each do |child|
      html += template('tr', classes: 'stack-cell', contents: child.to_html)
    end
    node.replace(template('table-to-tbody', classes: node['class'], contents: html))
  end
end

#stack_rowObject



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

def stack_row
  each_node('.stack-row') do |node|
    html = ''
    node.xpath('./*').each do |child|
      html += template('td', classes: 'stack-cell', contents: child.to_html)
    end
    node.replace(template('table-to-tr', classes: node['class'], contents: html))
  end
end