Sha256: 7806b40ac88cd80294d707810b8eb2a3c65a4511eac4578131c9eb7abc2bb2e8
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module Asynchronic class Job attr_reader :id attr_reader :name attr_reader :queue attr_reader :parent attr_reader :dependencies attr_reader :local def initialize(options={}) @id = SecureRandom.uuid @name = options.key?(:alias) ? options[:alias].to_s : self.class.to_s @queue = options[:queue] || self.class.queue @parent = options[:parent] @dependencies = Array(options[:dependencies] || options[:dependency]).map(&:to_s) @local = options[:local] || {} raise 'Cant have dependencies without parent job' if dependencies.any? && parent.nil? end def lookup DataStore::Lookup.new self end def self.queue(queue=nil) queue ? @queue = queue : @queue end def self.implementation @implementation end def self.enqueue(data={}) process = Asynchronic.environment.build_process self process.enqueue data end private def self.define(&block) @implementation = block end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
asynchronic-0.1.0 | lib/asynchronic/job.rb |