class Async::Container::Notify::Server

Constants

MAXIMUM_MESSAGE_SIZE
NOTIFY_SOCKET

Attributes

path[R]

Public Class Methods

generate_path() click to toggle source
# File lib/async/container/notify/server.rb, line 57
def self.generate_path
        File.expand_path(
                "async-container-#{::Process.pid}-#{SecureRandom.hex(8)}.ipc",
                Dir.tmpdir
        )
end
load(message) click to toggle source
# File lib/async/container/notify/server.rb, line 37
def self.load(message)
        lines = message.split("\n")
        
        lines.pop if lines.last == ""
        
        pairs = lines.map do |line|
                key, value = line.split("=", 2)
                
                if value == '0'
                        value = false
                elsif value == '1'
                        value = true
                end
                
                next [key.downcase.to_sym, value]
        end
        
        return Hash[pairs]
end
new(path) click to toggle source
# File lib/async/container/notify/server.rb, line 68
def initialize(path)
        @path = path
end
open(path = self.generate_path) click to toggle source
# File lib/async/container/notify/server.rb, line 64
def self.open(path = self.generate_path)
        self.new(path)
end

Public Instance Methods

bind() click to toggle source
# File lib/async/container/notify/server.rb, line 74
def bind
        Context.new(@path)
end