Class: Gienah::Testing::FakeTransport
- Inherits:
-
Object
- Object
- Gienah::Testing::FakeTransport
- Defined in:
- lib/gienah/testing/fake_plugin.rb
Instance Attribute Summary collapse
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #close ⇒ Object
-
#initialize(plugin, manifest, receive) ⇒ FakeTransport
constructor
A new instance of FakeTransport.
- #write(message) ⇒ Object
Constructor Details
#initialize(plugin, manifest, receive) ⇒ FakeTransport
Returns a new instance of FakeTransport.
55 56 57 58 59 60 61 |
# File 'lib/gienah/testing/fake_plugin.rb', line 55 def initialize(plugin, manifest, receive) @plugin = plugin @manifest = manifest @receive = receive @pid = Process.pid @closed = false end |
Instance Attribute Details
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
53 54 55 |
# File 'lib/gienah/testing/fake_plugin.rb', line 53 def pid @pid end |
Instance Method Details
#alive? ⇒ Boolean
70 71 72 |
# File 'lib/gienah/testing/fake_plugin.rb', line 70 def alive? !@closed end |
#close ⇒ Object
74 75 76 77 |
# File 'lib/gienah/testing/fake_plugin.rb', line 74 def close(**) @closed = true true end |
#write(message) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/gienah/testing/fake_plugin.rb', line 63 def write(, **) raise Error, "transport is closed" if @closed response = @plugin.dispatch() @receive.call(response, nil) if response nil end |