Class: ActiveMail::Components::Center

Inherits:
Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/activemail/components/center.rb

Constant Summary

Constants inherited from Base

Base::IGNORED_ON_PASSTHROUGH, Base::TABLE_RESET

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ActiveMail::Components::Base

Instance Method Details

#transform(node, _inner) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/activemail/components/center.rb', line 12

def transform(node, _inner)
  elements = node.elements
  elements.each do |child|
    child['align'] = 'center'
    child['class'] = combine_classes(child, 'float-center')
  end
  items = elements.css('.menu-item').to_a.concat(elements.css('item').to_a)
  items.each { |item| item['class'] = combine_classes(item, 'float-center') }
  node.to_s
end