Class: Noticed::Base
- Inherits:
-
Object
show all
- Extended by:
- ActiveModel::Callbacks
- Includes:
- Translation
- Defined in:
- lib/noticed/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#i18n_scope, #scope_translation_key, #translate
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
36
37
38
|
# File 'lib/noticed/base.rb', line 36
def initialize(params = {})
@params = params
end
|
Instance Attribute Details
#record ⇒ Object
Returns the value of attribute record.
12
13
14
|
# File 'lib/noticed/base.rb', line 12
def record
@record
end
|
Class Method Details
.deliver_by(name, options = {}) ⇒ Object
15
16
17
18
|
# File 'lib/noticed/base.rb', line 15
def deliver_by(name, options = {})
delivery_methods.push(name: name, options: options)
define_model_callbacks(name)
end
|
.inherited(base) ⇒ Object
Copy delivery methods from parent
21
22
23
24
25
|
# File 'lib/noticed/base.rb', line 21
def inherited(base) base.delivery_methods = delivery_methods.dup
base.param_names = param_names.dup
super
end
|
.param(name) ⇒ Object
31
32
33
|
# File 'lib/noticed/base.rb', line 31
def param(name)
param_names.push(name)
end
|
.with(params) ⇒ Object
27
28
29
|
# File 'lib/noticed/base.rb', line 27
def with(params)
new(params)
end
|
Instance Method Details
#deliver(recipient) ⇒ Object
40
41
42
43
|
# File 'lib/noticed/base.rb', line 40
def deliver(recipient)
validate!
run_delivery(recipient, enqueue: false)
end
|
#deliver_later(recipient) ⇒ Object
45
46
47
48
|
# File 'lib/noticed/base.rb', line 45
def deliver_later(recipient)
validate!
run_delivery(recipient, enqueue: true)
end
|
#params ⇒ Object
50
51
52
|
# File 'lib/noticed/base.rb', line 50
def params
@params || {}
end
|