Class: Nisetegami::TemplatePresenter
- Inherits:
-
Object
- Object
- Nisetegami::TemplatePresenter
show all
- Defined in:
- lib/nisetegami/template_presenter.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TemplatePresenter.
5
6
7
|
# File 'lib/nisetegami/template_presenter.rb', line 5
def initialize(template)
@template = template
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
30
31
32
|
# File 'lib/nisetegami/template_presenter.rb', line 30
def method_missing(method, *args, &block)
@template.send(method, *args, &block)
end
|
Instance Method Details
#action ⇒ Object
13
14
15
|
# File 'lib/nisetegami/template_presenter.rb', line 13
def action
I18n.t("nisetegami.actions.#{@template[:mailer].underscore}.#{@template.action}", default: @template.action.humanize)
end
|
#mailer ⇒ Object
9
10
11
|
# File 'lib/nisetegami/template_presenter.rb', line 9
def mailer
I18n.t("nisetegami.mailers.#{@template[:mailer].underscore}", default: @template.mailer)
end
|
#to_param ⇒ Object
26
27
28
|
# File 'lib/nisetegami/template_presenter.rb', line 26
def to_param
@template.id
end
|
#translate_variable(*args) ⇒ Object
17
18
19
20
|
# File 'lib/nisetegami/template_presenter.rb', line 17
def translate_variable(*args)
'(' + I18n.t!("nisetegami.variables.#{@template[:mailer].underscore}.#{@template.action}." << args.join('.')) + ')'
rescue I18n::MissingTranslationData
end
|