Sha256: 41c393fce37e913433f84f7bcb7a8ffe0295976072085218b28c276c482231f5

Contents?: true

Size: 567 Bytes

Versions: 2

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, :stats, :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

2 entries across 2 versions & 1 rubygems

Version Path
localjob-0.4.1 lib/localjob.rb
localjob-0.4.0 lib/localjob.rb