class Taskinator::Api::Processes

Attributes

scope[R]

Public Class Methods

new(scope=:shared) click to toggle source
# File lib/taskinator/api.rb, line 8
def initialize(scope=:shared)
  @scope = scope
  @processes_list_key = Taskinator::Persistence.processes_list_key(scope)
end

Public Instance Methods

each() { |fetch| ... } click to toggle source
# File lib/taskinator/api.rb, line 13
def each(&block)
  return to_enum(__method__) unless block_given?

  instance_cache = {}
  Taskinator.redis do |conn|
    uuids = conn.smembers(@processes_list_key)
    uuids.each do |uuid|
      yield Process.fetch(uuid, instance_cache)
    end
  end
end
size() click to toggle source
# File lib/taskinator/api.rb, line 25
def size
  Taskinator.redis do |conn|
    conn.scard(@processes_list_key)
  end
end