Class: Hanami::Extensions::Mailer::SliceConfiguredMailer Private

Inherits:
Module
  • Object
show all
Defined in:
lib/hanami/extensions/mailer/slice_configured_mailer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Provides slice-specific configuration and behavior for any mailer class defined within a slice’s module namespace.

This injects the slice’s ‘“mailers.delivery_method”` component into mailer instances, and points the mailer’s view at a slice-configured view class so that mailer templates behave like regular Hanami view templates — sharing the slice’s view context, parts, scopes and helpers (including i18n). The only behavior not available to mailer views is request-related state (‘request`/`session`/`flash`/`csrf_token`), since mailers are not rendered from a request.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slice) ⇒ SliceConfiguredMailer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SliceConfiguredMailer.

Since:

  • 0.1.0



20
21
22
23
# File 'lib/hanami/extensions/mailer/slice_configured_mailer.rb', line 20

def initialize(slice)
  super()
  @slice = slice
end

Instance Attribute Details

#sliceObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



18
19
20
# File 'lib/hanami/extensions/mailer/slice_configured_mailer.rb', line 18

def slice
  @slice
end

Instance Method Details

#extended(mailer_class) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



25
26
27
28
# File 'lib/hanami/extensions/mailer/slice_configured_mailer.rb', line 25

def extended(mailer_class)
  configure_mailer(mailer_class)
  define_new
end

#inspectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



30
31
32
# File 'lib/hanami/extensions/mailer/slice_configured_mailer.rb', line 30

def inspect
  "#<#{self.class.name}[#{slice.name}]>"
end