Class: Async::Container::Notify::Server
- Inherits:
-
Object
- Object
- Async::Container::Notify::Server
- Defined in:
- lib/async/container/notify/server.rb
Defined Under Namespace
Classes: Context
Constant Summary collapse
- NOTIFY_SOCKET =
'NOTIFY_SOCKET'
- MAXIMUM_MESSAGE_SIZE =
4096
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #bind ⇒ Object
-
#initialize(path) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(path) ⇒ Server
Returns a new instance of Server.
68 69 70 |
# File 'lib/async/container/notify/server.rb', line 68 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
72 73 74 |
# File 'lib/async/container/notify/server.rb', line 72 def path @path end |
Class Method Details
.generate_path ⇒ Object
57 58 59 60 61 62 |
# File 'lib/async/container/notify/server.rb', line 57 def self.generate_path File.( "async-container-#{::Process.pid}-#{SecureRandom.hex(8)}.ipc", Dir.tmpdir ) end |
.load(message) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/async/container/notify/server.rb', line 37 def self.load() lines = .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 |
.open(path = self.generate_path) ⇒ Object
64 65 66 |
# File 'lib/async/container/notify/server.rb', line 64 def self.open(path = self.generate_path) self.new(path) end |