Class: TranslationJobs::AutoTranslateJob
- Inherits:
-
Object
- Object
- TranslationJobs::AutoTranslateJob
- Defined in:
- lib/has_many_translations/translation_jobs.rb
Instance Attribute Summary collapse
-
#destination_locale ⇒ Object
Returns the value of attribute destination_locale.
-
#origin_locale ⇒ Object
Returns the value of attribute origin_locale.
-
#translated_id ⇒ Object
Returns the value of attribute translated_id.
-
#translated_type ⇒ Object
Returns the value of attribute translated_type.
Instance Method Summary collapse
-
#initialize(options) ⇒ AutoTranslateJob
constructor
A new instance of AutoTranslateJob.
- #perform(options = nil) ⇒ Object
Constructor Details
#initialize(options) ⇒ AutoTranslateJob
Returns a new instance of AutoTranslateJob.
19 20 21 22 23 24 |
# File 'lib/has_many_translations/translation_jobs.rb', line 19 def initialize() @translated_id = ["translated_id"]||[:translated_id] @translated_type = ["translated_type"]||[:translated_type] @origin_locale = ["origin_locale"]||[:origin_locale] @destination_locale = ["destination_locale"]|| [:destination_locale] end |
Instance Attribute Details
#destination_locale ⇒ Object
Returns the value of attribute destination_locale.
17 18 19 |
# File 'lib/has_many_translations/translation_jobs.rb', line 17 def destination_locale @destination_locale end |
#origin_locale ⇒ Object
Returns the value of attribute origin_locale.
17 18 19 |
# File 'lib/has_many_translations/translation_jobs.rb', line 17 def origin_locale @origin_locale end |
#translated_id ⇒ Object
Returns the value of attribute translated_id.
17 18 19 |
# File 'lib/has_many_translations/translation_jobs.rb', line 17 def translated_id @translated_id end |
#translated_type ⇒ Object
Returns the value of attribute translated_type.
17 18 19 |
# File 'lib/has_many_translations/translation_jobs.rb', line 17 def translated_type @translated_type end |
Instance Method Details
#perform(options = nil) ⇒ Object
26 27 28 29 |
# File 'lib/has_many_translations/translation_jobs.rb', line 26 def perform( = nil) translatable = Kernel.const_get(@translated_type).find(@translated_id) translatable.update_all_attributes_translation(@destination_locale, @origin_locale) end |