Sha256: 367bd5c377f4a27d93d8a6add661a2d9fc749d8e0f8b7ab7338c49c654431756
Contents?: true
Size: 690 Bytes
Versions: 1
Compression:
Stored size: 690 Bytes
Contents
require 'posix/mqueue' require 'yaml' require 'logger' require "localjob/version" require 'localjob/channel' require 'localjob/worker' class Localjob attr_reader :queue_name def initialize(queue = "localjob") @queue_name = fix_queue_name(queue) end def serializer YAML end def queue @queue ||= POSIX::Mqueue.new(@queue_name) end def <<(object) queue.timedsend serializer.dump(object) end def size queue.size end def shift serializer.load queue.timedreceive end def destroy queue.unlink end def to_io queue.to_io end private def fix_queue_name(queue) queue.start_with?('/') ? queue : "/#{queue}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
localjob-0.0.1 | lib/localjob.rb |