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
-
#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.
139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/activemail/configuration.rb', line 139 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) end |
Instance Attribute Details
#column_count ⇒ Object
Returns the value of attribute column_count.
122 123 124 |
# File 'lib/activemail/configuration.rb', line 122 def column_count @column_count end |
#container_width ⇒ Object
Returns the value of attribute container_width.
125 126 127 |
# File 'lib/activemail/configuration.rb', line 125 def container_width @container_width end |
#inliner ⇒ Object
Returns the value of attribute inliner.
102 103 104 |
# File 'lib/activemail/configuration.rb', line 102 def inliner @inliner end |
#on_parse_error ⇒ Object
Returns the value of attribute on_parse_error.
119 120 121 |
# File 'lib/activemail/configuration.rb', line 119 def on_parse_error @on_parse_error end |
#register_inline_interceptor ⇒ Object
Returns the value of attribute register_inline_interceptor.
106 107 108 |
# File 'lib/activemail/configuration.rb', line 106 def register_inline_interceptor @register_inline_interceptor end |
#template_engine ⇒ Object
Returns the value of attribute template_engine.
116 117 118 |
# File 'lib/activemail/configuration.rb', line 116 def template_engine @template_engine end |
Instance Method Details
#components ⇒ Object
129 130 131 |
# File 'lib/activemail/configuration.rb', line 129 def components @components.dup.freeze end |
#components=(value) ⇒ Object
192 193 194 195 196 197 198 199 |
# File 'lib/activemail/configuration.rb', line 192 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
202 203 204 205 206 |
# File 'lib/activemail/configuration.rb', line 202 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
162 163 164 |
# File 'lib/activemail/configuration.rb', line 162 def resolved_inliner @resolved_inliner ||= resolve_inliner(@inliner) end |
#tokens ⇒ Object
134 135 136 |
# File 'lib/activemail/configuration.rb', line 134 def tokens @tokens ||= T.let(ActiveMail::Tokens.new, T.nilable(ActiveMail::Tokens)) end |