Sha256: 6d366ba0a22d7072c4af16e096d7281e35b92be5b4a0f82827322f27544190dc

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 Bytes

Contents

class Localjob
  class LinuxAdapter
    attr_reader :mqueue

    def initialize(name)
      @mqueue = POSIX::Mqueue.new(fix_queue_name(name))
    end

    def receive
      @mqueue.timedreceive
    end

    def send(message)
      @mqueue.timedsend message
    end

    def size
      @mqueue.size
    end

    def destroy
      @mqueue.unlink
    end

    def to_io
      @mqueue.to_io
    end

    private
    def fix_queue_name(name)
      name.start_with?('/') ? name : "/#{name}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
localjob-0.0.2 lib/localjob/linux_adapter.rb