Module: Elevate

Defined in:
lib/elevate/http.rb,
lib/elevate/task.rb,
lib/elevate/future.rb,
lib/elevate/channel.rb,
lib/elevate/elevate.rb,
lib/elevate/version.rb,
lib/elevate/http/uri.rb,
lib/elevate/operation.rb,
lib/elevate/http/base64.rb,
lib/elevate/http/errors.rb,
lib/elevate/http/thread.rb,
lib/elevate/http/request.rb,
lib/elevate/task_context.rb,
lib/elevate/http/response.rb,
lib/elevate/io_coordinator.rb,
lib/elevate/task_definition.rb,
lib/elevate/http/http_client.rb,
lib/elevate/http/activity_indicator.rb

Defined Under Namespace

Modules: ClassMethods, HTTP Classes: CancelledError, Channel, ElevateOperation, Future, IOCoordinator, Task, TaskContext, TaskDefinition, TimeoutError

Constant Summary collapse

VERSION =
"0.7.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
# File 'lib/elevate/elevate.rb', line 2

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#cancel(name) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/elevate/elevate.rb', line 16

def cancel(name)
  active_tasks.each do |task|
    if task.name == name
      task.cancel
    end
  end
end

#cancel_allObject



24
25
26
27
28
# File 'lib/elevate/elevate.rb', line 24

def cancel_all
  active_tasks.each do |task|
    task.cancel
  end
end

#launch(name, args = {}) ⇒ Object

Raises:

  • (ArgumentError)


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

def launch(name, args = {})
  raise ArgumentError, "args must be a Hash" unless args.is_a? Hash

  definition = self.class.task_definitions[name.to_sym]

  task = Task.new(definition, self, active_tasks)
  task.start(args)

  task
end

#task_argsObject



41
42
43
# File 'lib/elevate/elevate.rb', line 41

def task_args
  @__elevate_task_args
end

#task_args=(args) ⇒ Object



45
46
47
# File 'lib/elevate/elevate.rb', line 45

def task_args=(args)
  @__elevate_task_args = args
end