Class: SendgridNotification::TemplateParametersValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- SendgridNotification::TemplateParametersValidator
- Defined in:
- app/models/sendgrid_notification/template_parameters_validator.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ TemplateParametersValidator
constructor
A new instance of TemplateParametersValidator.
- #validate(record) ⇒ Object
Constructor Details
#initialize(options) ⇒ TemplateParametersValidator
Returns a new instance of TemplateParametersValidator.
3 4 5 |
# File 'app/models/sendgrid_notification/template_parameters_validator.rb', line 3 def initialize() @parameter_keys ||= Array([:parameters]) || [] end |
Instance Method Details
#validate(record) ⇒ Object
7 8 9 10 |
# File 'app/models/sendgrid_notification/template_parameters_validator.rb', line 7 def validate(record) params = @parameter_keys.map{|k| [k, k] }.to_h record.apply(params) end |