Sha256: 630e070f5e1dc96e9ce4b879b0039e1bd2a41dd48457bd50651192a728f2c869

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

require 'yaml'
require 'logger'
require 'forwardable'

require "localjob/version"
require 'localjob/worker'
require 'localjob/sysv_adapter'

class Localjob
  extend Forwardable

  attr_reader :name
  attr_accessor :queue

  def_delegators :queue, :to_io, :destroy, :size

  # LOCALJOB in 1337speak
  def initialize(name = 0x10CA110B)
    @name = name
  end

  def serializer
    YAML
  end

  def queue
    @queue ||= SysvAdapter.new(@name)
  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.3.0 lib/localjob.rb