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.



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

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.



73
74
75
76
# File 'lib/mutant/pipe.rb', line 73

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.



78
79
80
# File 'lib/mutant/pipe.rb', line 78

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.



82
83
84
85
# File 'lib/mutant/pipe.rb', line 82

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