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.
52 53 54 |
# File 'lib/async/container/notify/server.rb', line 52 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
56 57 58 |
# File 'lib/async/container/notify/server.rb', line 56 def path @path end |
Class Method Details
.generate_path ⇒ Object
41 42 43 44 45 46 |
# File 'lib/async/container/notify/server.rb', line 41 def self.generate_path File.( "async-container-#{::Process.pid}-#{SecureRandom.hex(8)}.ipc", Dir.tmpdir ) end |
.load(message) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/async/container/notify/server.rb', line 21 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
48 49 50 |
# File 'lib/async/container/notify/server.rb', line 48 def self.open(path = self.generate_path) self.new(path) end |