Class: TranslationJobs::MachineTranslationJob

Inherits:
Object
  • Object
show all
Defined in:
lib/has_many_translations/translation_jobs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ MachineTranslationJob

Returns a new instance of MachineTranslationJob.



5
6
7
8
# File 'lib/has_many_translations/translation_jobs.rb', line 5

def initialize(options)
  @translated_id = options["translated_id"] || options[:translated_id]
  @translated_type =  options["translated_type"] || options[:translated_type]
end

Instance Attribute Details

#translated_idObject

Returns the value of attribute translated_id.



4
5
6
# File 'lib/has_many_translations/translation_jobs.rb', line 4

def translated_id
  @translated_id
end

#translated_typeObject

Returns the value of attribute translated_type.



4
5
6
# File 'lib/has_many_translations/translation_jobs.rb', line 4

def translated_type
  @translated_type
end

Instance Method Details

#performObject



9
10
11
12
13
# File 'lib/has_many_translations/translation_jobs.rb', line 9

def perform
  translatable = Kernel.const_get(@translated_type).find(@translated_id)
  translatable.update_translations!
 
end