Class: Plug::TaskExecutionService

Inherits:
Object
  • Object
show all
Defined in:
app/services/plug/task_execution_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil) ⇒ TaskExecutionService

Returns a new instance of TaskExecutionService.



9
10
11
12
13
# File 'app/services/plug/task_execution_service.rb', line 9

def initialize(name: nil)
  raise 'Task name is required' if name.nil?

  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'app/services/plug/task_execution_service.rb', line 7

def name
  @name
end

Instance Method Details

#callObject



15
16
17
18
# File 'app/services/plug/task_execution_service.rb', line 15

def call
  Rails.application.load_tasks
  Rake::Task[name].execute
end