Sha256: 4def3cafe4e283065ca216824ab567e86a9fe1e2765b3c57f9fa566326cd235d

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

module BootstrapEmail
  module Component
    class Stack < Base
      def build
        stack_x
        stack_y
      end

      def stack_x
        each_node('.stack-x') 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

      def stack_y
        each_node('.stack-y') 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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap-email-1.0.0.alpha2.1 lib/bootstrap-email/components/stack.rb
bootstrap-email-1.0.0.alpha2 lib/bootstrap-email/components/stack.rb