Class: Panthoot::Translator
- Inherits:
-
Object
- Object
- Panthoot::Translator
- Defined in:
- lib/panthoot/translator.rb
Constant Summary collapse
- DATA_CLASSES =
{ 'subscribe' => Panthoot::Data::Subscription, 'unsubscribe' => Panthoot::Data::Unsubscription, 'profile' => Panthoot::Data::Profile, 'upemail' => Panthoot::Data::EmailAddressChange, 'cleaned' => Panthoot::Data::CleanedEmail, 'campaign' => Panthoot::Data::CampaignSendingStatus }
- LISTENER_METHODS =
{ 'subscribe' => 'subscribe', 'unsubscribe' => 'unsubscribe', 'profile' => 'profile_update', 'upemail' => 'email_address_change', 'cleaned' => 'email_cleaned', 'campaign' => 'campaign_sending_status' }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Translator
constructor
A new instance of Translator.
- #translate! ⇒ Object
Constructor Details
#initialize(params) ⇒ Translator
Returns a new instance of Translator.
21 22 23 |
# File 'lib/panthoot/translator.rb', line 21 def initialize(params) @params = params end |
Class Method Details
.translate!(params) ⇒ Object
17 18 19 |
# File 'lib/panthoot/translator.rb', line 17 def self.translate!(params) new(params).translate! end |
Instance Method Details
#translate! ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/panthoot/translator.rb', line 25 def translate! key = LISTENER_METHODS[type] return if key.nil? ActiveSupport::Notifications.instrument "#{key}.panthoot", key.to_sym => translated_object, :fired_at => fired_at end |