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



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

def build
  stack_row
  stack_col
end

#stack_colObject



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

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



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

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