Sha256: 371f458928280afa54d85290aeb4adac7d285dde59d7277aa9acbaef357d9122

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

module TranslationJobs
      class MachineTranslationJob
        attr_accessor :translated_id, :translated_type
         def initialize(options)
            @translated_id = options["translated_id"] || options[:translated_id]
            @translated_type =  options["translated_type"] || options[:translated_type]
          end
           def perform
             translatable = Kernel.const_get(@translated_type).find(@translated_id)
             translatable.update_translations!
            
           end
      end
      
      class AutoTranslateJob 
        attr_accessor :translated_id, :translated_type, :origin_locale, :destination_locale
        
        def initialize(options)
          @translated_id = options["translated_id"]||options[:translated_id]
          @translated_type =  options["translated_type"]||options[:translated_type]
          @origin_locale =  options["origin_locale"]||options[:origin_locale]
          @destination_locale = options["destination_locale"]|| options[:destination_locale]
        end
        
        def perform(options = nil)
          translatable = Kernel.const_get(@translated_type).find(@translated_id)
          translatable.update_all_attributes_translation(@destination_locale, @origin_locale)
        end
        
        
      end 
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
has_many_translations-0.4.6 lib/has_many_translations/translation_jobs.rb
has_many_translations-0.4.5 lib/has_many_translations/translation_jobs.rb
has_many_translations-0.4.4 lib/has_many_translations/translation_jobs.rb
has_many_translations-0.4.3 lib/has_many_translations/translation_jobs.rb
has_many_translations-0.3.8 lib/has_many_translations/translation_jobs.rb
has_many_translations-0.3.7 lib/has_many_translations/translation_jobs.rb
has_many_translations-0.3.6 lib/has_many_translations/translation_jobs.rb
has_many_translations-0.3.4 lib/has_many_translations/translation_jobs.rb
has_many_translations-0.3.3 lib/has_many_translations/translation_jobs.rb