Class: ActiveMail::Configuration
- Inherits:
-
Object
- Object
- ActiveMail::Configuration
- Extended by:
- T::Sig
- Defined in:
- lib/activemail/configuration.rb
Constant Summary collapse
- ON_PARSE_ERROR_MODES =
T.let(%i[ignore warn raise].freeze, T::Array[Symbol])
- INLINERS =
T.let( { premailer: ActiveMail::Inliner::Premailer, roadie: ActiveMail::Inliner::Roadie, null: ActiveMail::Inliner::Null }.freeze, T::Hash[Symbol, T.class_of(ActiveMail::Inliner::Base)] )
- InlinerSetting =
T.type_alias { T.any(Symbol, ActiveMail::Inliner::Base, T.class_of(ActiveMail::Inliner::Base)) }
Instance Attribute Summary collapse
-
#blank_link_rel ⇒ Object
Returns the value of attribute blank_link_rel.
-
#column_count ⇒ Object
Returns the value of attribute column_count.
-
#container_width ⇒ Object
Returns the value of attribute container_width.
-
#inliner ⇒ Object
Returns the value of attribute inliner.
-
#on_parse_error ⇒ Object
Returns the value of attribute on_parse_error.
-
#register_inline_interceptor ⇒ Object
Returns the value of attribute register_inline_interceptor.
-
#template_engine ⇒ Object
Returns the value of attribute template_engine.
Instance Method Summary collapse
- #components ⇒ Object
- #components=(value) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register_component(tag, component_class) ⇒ Object
- #resolved_inliner ⇒ Object
- #tokens ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/activemail/configuration.rb', line 143 def initialize @template_engine = T.let(:erb, Symbol) @column_count = T.let(12, Integer) @container_width = T.let(600, Integer) @components = T.let({}, ActiveMail::ComponentMap) @on_parse_error = T.let(:warn, Symbol) @tokens = T.let(nil, T.nilable(ActiveMail::Tokens)) @inliner = T.let(:premailer, InlinerSetting) @resolved_inliner = T.let(nil, T.nilable(ActiveMail::Inliner::Base)) @register_inline_interceptor = T.let(true, T::Boolean) @blank_link_rel = T.let('noopener', T.nilable(String)) end |
Instance Attribute Details
#blank_link_rel ⇒ Object
Returns the value of attribute blank_link_rel.
129 130 131 |
# File 'lib/activemail/configuration.rb', line 129 def blank_link_rel @blank_link_rel end |
#column_count ⇒ Object
Returns the value of attribute column_count.
126 127 128 |
# File 'lib/activemail/configuration.rb', line 126 def column_count @column_count end |
#container_width ⇒ Object
Returns the value of attribute container_width.
126 127 128 |
# File 'lib/activemail/configuration.rb', line 126 def container_width @container_width end |
#inliner ⇒ Object
Returns the value of attribute inliner.
109 110 111 |
# File 'lib/activemail/configuration.rb', line 109 def inliner @inliner end |
#on_parse_error ⇒ Object
Returns the value of attribute on_parse_error.
123 124 125 |
# File 'lib/activemail/configuration.rb', line 123 def on_parse_error @on_parse_error end |
#register_inline_interceptor ⇒ Object
Returns the value of attribute register_inline_interceptor.
113 114 115 |
# File 'lib/activemail/configuration.rb', line 113 def register_inline_interceptor @register_inline_interceptor end |
#template_engine ⇒ Object
Returns the value of attribute template_engine.
123 124 125 |
# File 'lib/activemail/configuration.rb', line 123 def template_engine @template_engine end |
Instance Method Details
#components ⇒ Object
133 134 135 |
# File 'lib/activemail/configuration.rb', line 133 def components @components.dup.freeze end |
#components=(value) ⇒ Object
205 206 207 208 209 210 211 212 |
# File 'lib/activemail/configuration.rb', line 205 def components=(value) raise TypeError, "#{value.inspect} (#{value.class}) does not respond to 'to_hash'" unless value.respond_to?(:to_hash) # Lookup is by node name (String); a Symbol key would never match. normalized = value.to_hash.transform_keys(&:to_s) normalized.each { |tag, klass| ActiveMail::Components.validate_component!(tag, klass) } @components = normalized end |
#register_component(tag, component_class) ⇒ Object
215 216 217 218 219 |
# File 'lib/activemail/configuration.rb', line 215 def register_component(tag, component_class) ActiveMail::Components.validate_component!(tag, component_class) @components = @components.merge(tag.to_s => component_class) end |
#resolved_inliner ⇒ Object
167 168 169 |
# File 'lib/activemail/configuration.rb', line 167 def resolved_inliner @resolved_inliner ||= resolve_inliner(@inliner) end |
#tokens ⇒ Object
138 139 140 |
# File 'lib/activemail/configuration.rb', line 138 def tokens @tokens ||= T.let(ActiveMail::Tokens.new, T.nilable(ActiveMail::Tokens)) end |