Sha256: f42e9dc17226de3863b0e956e9dbad76c9be137155e5f29c0ec0bc83aa9b6e38
Contents?: true
Size: 791 Bytes
Versions: 1
Compression:
Stored size: 791 Bytes
Contents
begin require 'posix/mqueue' rescue LoadError end require 'yaml' require 'logger' require 'forwardable' require "localjob/version" require 'localjob/channel' require 'localjob/worker' class Localjob extend Forwardable attr_reader :name attr_accessor :queue def_delegators :queue, :to_io, :destroy, :size def initialize(name = "localjob") @name = name end def serializer YAML end def queue return @queue if @queue case RUBY_PLATFORM when /linux/ require 'localjob/linux_adapter' @queue = LinuxAdapter.new(@name) else require 'localjob/mock_adapter' @queue = MockAdapter.new(@name) end end def <<(object) queue.send serializer.dump(object) end def shift serializer.load queue.receive end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
localjob-0.0.2 | lib/localjob.rb |