Class: Hanami::Mailer::DSL::BoundAttachment Private
- Inherits:
-
Object
- Object
- Hanami::Mailer::DSL::BoundAttachment
- Defined in:
- lib/hanami/mailer/dsl/attachments.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.
A bound attachment definition that can be evaluated in the context of a mailer instance.
Instance Method Summary collapse
-
#call(input, dependencies = {}) ⇒ Object
private
Evaluates the attachment definition and returns an array of Attachment objects.
-
#initialize(name_or_filename, proc, object, **options) ⇒ BoundAttachment
constructor
private
A new instance of BoundAttachment.
Constructor Details
#initialize(name_or_filename, proc, object, **options) ⇒ BoundAttachment
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 BoundAttachment.
67 68 69 70 71 72 |
# File 'lib/hanami/mailer/dsl/attachments.rb', line 67 def initialize(name_or_filename, proc, object, **) @name_or_filename = name_or_filename @object = object @options = @callable = PluckyProc.from_name(proc, name_or_filename, object) || static_callable end |
Instance Method Details
#call(input, dependencies = {}) ⇒ 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.
Evaluates the attachment definition and returns an array of Attachment objects.
Positional parameters resolve against ‘dependencies` (the mailer’s exposure values); keyword parameters resolve against ‘input`.
78 79 80 |
# File 'lib/hanami/mailer/dsl/attachments.rb', line 78 def call(input, dependencies = {}) Array(@callable.call(input, *dependency_args(dependencies))).each { (_1) } end |