Class: Mailtime::Configuration
- Inherits:
-
Object
- Object
- Mailtime::Configuration
- Defined in:
- lib/mailtime/configuration.rb
Instance Attribute Summary collapse
-
#fallback ⇒ Object
Returns the value of attribute fallback.
-
#log ⇒ Object
Returns the value of attribute log.
-
#log_fields ⇒ Object
Returns the value of attribute log_fields.
-
#loggable_lookups ⇒ Object
Returns the value of attribute loggable_lookups.
-
#mailers ⇒ Object
Returns the value of attribute mailers.
-
#reject_scope_keys ⇒ Object
Returns the value of attribute reject_scope_keys.
-
#render ⇒ Object
Returns the value of attribute render.
-
#valid_formats ⇒ Object
Returns the value of attribute valid_formats.
-
#yield_keyword ⇒ Object
Returns the value of attribute yield_keyword.
Class Method Summary collapse
- .loggable_lookups ⇒ Object
-
.loggable_lookups=(val) ⇒ Object
does nothing on purpose.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_mailers ⇒ Object
- #loggables ⇒ Object
- #mailer(klass) ⇒ Object
- #preload_mailers ⇒ Object
- #preload_mailers! ⇒ Object
- #valid_extensions ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mailtime/configuration.rb', line 20 def initialize @mailers = load_mailers @render = true @log = true @log_fields = [:to] @fallback = true @reject_scope_keys = ['devise_mapping', 'scope_name'] @loggable_lookups = Mailtime.loggable_lookups @yield_keyword = '{{ mailtime_yield }}' @valid_formats = %w{html text} end |
Instance Attribute Details
#fallback ⇒ Object
Returns the value of attribute fallback.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def fallback @fallback end |
#log ⇒ Object
Returns the value of attribute log.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def log @log end |
#log_fields ⇒ Object
Returns the value of attribute log_fields.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def log_fields @log_fields end |
#loggable_lookups ⇒ Object
Returns the value of attribute loggable_lookups.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def loggable_lookups @loggable_lookups end |
#mailers ⇒ Object
Returns the value of attribute mailers.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def mailers @mailers end |
#reject_scope_keys ⇒ Object
Returns the value of attribute reject_scope_keys.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def reject_scope_keys @reject_scope_keys end |
#render ⇒ Object
Returns the value of attribute render.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def render @render end |
#valid_formats ⇒ Object
Returns the value of attribute valid_formats.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def valid_formats @valid_formats end |
#yield_keyword ⇒ Object
Returns the value of attribute yield_keyword.
10 11 12 |
# File 'lib/mailtime/configuration.rb', line 10 def yield_keyword @yield_keyword end |
Class Method Details
.loggable_lookups ⇒ Object
43 44 45 |
# File 'lib/mailtime/configuration.rb', line 43 def self.loggable_lookups @loggable_lookups ||= [] end |
.loggable_lookups=(val) ⇒ Object
does nothing on purpose.
48 49 50 |
# File 'lib/mailtime/configuration.rb', line 48 def self.loggable_lookups=(val) @loggable_lookups end |
Instance Method Details
#load_mailers ⇒ Object
65 66 67 |
# File 'lib/mailtime/configuration.rb', line 65 def load_mailers ObjectSpace.each_object(Class).select { |klass| klass < ::ActionMailer::Base } end |
#loggables ⇒ Object
36 37 38 39 40 41 |
# File 'lib/mailtime/configuration.rb', line 36 def loggables @loggable_lookups.each_with_object({}) do |k,h| key = k.keys.first h[key] = k[key] end end |
#mailer(klass) ⇒ Object
32 33 34 |
# File 'lib/mailtime/configuration.rb', line 32 def mailer(klass) @mailers << klass end |
#preload_mailers ⇒ Object
60 61 62 63 |
# File 'lib/mailtime/configuration.rb', line 60 def preload_mailers Dir.glob(::Rails.root.join("app/mailers/**/*_mailer.rb")) .each { |klass| require klass } end |
#preload_mailers! ⇒ Object
56 57 58 |
# File 'lib/mailtime/configuration.rb', line 56 def preload_mailers! preload_mailers end |
#valid_extensions ⇒ Object
52 53 54 |
# File 'lib/mailtime/configuration.rb', line 52 def valid_extensions Mailtime::Renderers::BaseRenderer.descendants.map(&:renders).flatten end |