Class: Mutant::Pipe::Connection Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mutant/pipe.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Frame

Constant Summary collapse

Error =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Class.new(RuntimeError)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_pipes(marshal:, reader:, writer:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



85
86
87
88
89
90
91
# File 'lib/mutant/pipe.rb', line 85

def self.from_pipes(marshal:, reader:, writer:)
  new(
    marshal: marshal,
    reader:  Frame.new(reader.to_reader),
    writer:  Frame.new(writer.to_writer)
  )
end

Instance Method Details

#call(payload) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



71
72
73
74
# File 'lib/mutant/pipe.rb', line 71

def call(payload)
  send_value(payload)
  receive_value
end

#receive_valueObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



76
77
78
# File 'lib/mutant/pipe.rb', line 76

def receive_value
  marshal.load(reader.receive_value)
end

#send_value(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



80
81
82
83
# File 'lib/mutant/pipe.rb', line 80

def send_value(value)
  writer.send_value(marshal.dump(value))
  self
end