Sha256: 43fe563d03fd48ddd348f11ee51b64fd37ffefc01212e8562ea55f434aa6f9b1

Contents?: true

Size: 1.53 KB

Versions: 31

Compression:

Stored size: 1.53 KB

Contents

module Isomorfeus
  class << self
    def cached_operation_classes
      @cached_operation_classes ||= {}
    end

    def cached_operation_class(class_name)
      return "::#{class_name}".constantize if Isomorfeus.development?
      return cached_operation_classes[class_name] if cached_operation_classes.key?(class_name)
      cached_operation_classes[class_name] = "::#{class_name}".constantize
    end

    if RUBY_ENGINE != 'opal'
      attr_accessor :operation_timer_tasks

      def valid_operation_class_names
        @valid_operation_class_names ||= Set.new
      end

      def valid_operation_class_name?(class_name)
        valid_operation_class_names.include?(class_name)
      end

      def add_valid_operation_class(klass)
        class_name = klass.name
        class_name = class_name.split('>::').last if class_name.start_with?('#<')
        valid_operation_class_names << class_name
      end

      def pop_failed_tasks
        failed_tasks = []
        [Isomorfeus::Operation::DeferredTask, Isomorfeus::Operation::DailyTask].each do |task_class|
          task_class.search(:failed).each do |task|
            failed_tasks << task
            task.destroy
          end
        end
        failed_tasks
      end

      def all_tasks
        all_tasks = []
        [Isomorfeus::Operation::DeferredTask, Isomorfeus::Operation::DailyTask].each do |task_class|
          task_class.each do |task|
            all_tasks << task
          end
        end
        all_tasks
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
isomorfeus-operation-23.6.0.rc5 lib/isomorfeus/operation/config.rb
isomorfeus-operation-23.6.0.rc4 lib/isomorfeus/operation/config.rb
isomorfeus-operation-23.6.0.rc3 lib/isomorfeus/operation/config.rb
isomorfeus-operation-23.6.0.rc2 lib/isomorfeus/operation/config.rb
isomorfeus-operation-23.6.0.rc1 lib/isomorfeus/operation/config.rb
isomorfeus-operation-23.1.0.rc2 lib/isomorfeus/operation/config.rb
isomorfeus-operation-23.1.0.rc1 lib/isomorfeus/operation/config.rb
isomorfeus-operation-22.11.0.rc1 lib/isomorfeus/operation/config.rb
isomorfeus-operation-22.10.0.rc2 lib/isomorfeus/operation/config.rb
isomorfeus-operation-22.10.0.rc1 lib/isomorfeus/operation/config.rb
isomorfeus-operation-22.9.0.rc9 lib/isomorfeus/operation/config.rb