Module: Isomorfeus

Defined in:
lib/isomorfeus/operation/config.rb,
lib/isomorfeus/operation/version.rb,
lib/isomorfeus/operation/run_task.rb,
lib/isomorfeus/operation/daily_task.rb,
lib/isomorfeus/operation/deferred_task.rb,
lib/isomorfeus/operation/generic_class_api.rb,
lib/isomorfeus/operation/handler/operation_handler.rb

Defined Under Namespace

Modules: Operation

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#operation_timer_tasksObject

Returns the value of attribute operation_timer_tasks.



14
15
16
# File 'lib/isomorfeus/operation/config.rb', line 14

def operation_timer_tasks
  @operation_timer_tasks
end

Class Method Details

.cached_operation_class(class_name) ⇒ Object



7
8
9
10
11
# File 'lib/isomorfeus/operation/config.rb', line 7

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

.cached_operation_classesObject



3
4
5
# File 'lib/isomorfeus/operation/config.rb', line 3

def cached_operation_classes
  @cached_operation_classes ||= {}
end

Instance Method Details

#add_valid_operation_class(klass) ⇒ Object



24
25
26
27
28
# File 'lib/isomorfeus/operation/config.rb', line 24

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

#all_tasksObject



41
42
43
44
45
46
47
48
49
# File 'lib/isomorfeus/operation/config.rb', line 41

def all_tasks
  all_tasks = []
  [Isomorfeus::Operation::DeferredTask, Isomorfeus::Operation::DailyTask].each do |task_class|
    task_class.search(:state, '*').each do |task|
      all_tasks << task
    end
  end
  all_tasks
end

#pop_failed_tasksObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/isomorfeus/operation/config.rb', line 30

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

#valid_operation_class_name?(class_name) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/isomorfeus/operation/config.rb', line 20

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

#valid_operation_class_namesObject



16
17
18
# File 'lib/isomorfeus/operation/config.rb', line 16

def valid_operation_class_names
  @valid_operation_class_names ||= Set.new
end