interop 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/interop/message.rb +1 -1
- data/lib/interop/stream_adapter.rb +17 -0
- data/lib/interop/stream_reader.rb +2 -7
- data/lib/interop/stream_writer.rb +2 -7
- data/lib/interop/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d87e7c23c67f9e2d514ff393cee8789856588ff4b399e51305008608d9e9d316
|
4
|
+
data.tar.gz: bbb0a45add6f441698a5f4d07016d9613b36f3273f51c891894742090fce6769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fce7c36089b584c1b2496705ff4dec7e1902db1e965327fc50fded4c26483a6fc4733021287d7c262754cae2abf4da663a464a579b848242d883c023a957a3f
|
7
|
+
data.tar.gz: fc4a78d74b5af7eb5aad0ac5aaa1a8972a720a535ab233587e26c0f5f0a9e689fcb7a85450f9a6436e216c52aaaee88ddb2eac2f797328a632f28da28567e742
|
data/lib/interop/message.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Hx
|
2
|
+
module Interop
|
3
|
+
# Base class for StreamReader and StreamWriter
|
4
|
+
class StreamAdapter
|
5
|
+
# @param [IO, StringIO] stream
|
6
|
+
def initialize(stream)
|
7
|
+
if stream.is_a? IO
|
8
|
+
stream.sync = true
|
9
|
+
stream.binmode
|
10
|
+
end
|
11
|
+
|
12
|
+
@stream = stream
|
13
|
+
@mutex = Mutex.new
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -2,22 +2,17 @@ require 'set'
|
|
2
2
|
|
3
3
|
require 'interop/message'
|
4
4
|
require 'interop/reader'
|
5
|
+
require 'interop/stream_adapter'
|
5
6
|
|
6
7
|
module Hx
|
7
8
|
module Interop
|
8
9
|
# Reads messages from a stream (e.g. STDIN)
|
9
|
-
class StreamReader
|
10
|
+
class StreamReader < StreamAdapter
|
10
11
|
include Reader
|
11
12
|
|
12
13
|
# Acceptable line terminators
|
13
14
|
NEWLINES = Set.new(%W[\n \r\n]).freeze
|
14
15
|
|
15
|
-
# @param [IO, StringIO] stream
|
16
|
-
def initialize(stream)
|
17
|
-
@stream = stream
|
18
|
-
@mutex = Mutex.new
|
19
|
-
end
|
20
|
-
|
21
16
|
protected
|
22
17
|
|
23
18
|
def _read
|
@@ -1,18 +1,13 @@
|
|
1
1
|
require 'interop/message'
|
2
2
|
require 'interop/writer'
|
3
|
+
require 'interop/stream_adapter'
|
3
4
|
|
4
5
|
module Hx
|
5
6
|
module Interop
|
6
7
|
# Writes messages to a stream (e.g. STDOUT)
|
7
|
-
class StreamWriter
|
8
|
+
class StreamWriter < StreamAdapter
|
8
9
|
include Writer
|
9
10
|
|
10
|
-
# @param [IO, StringIO] stream
|
11
|
-
def initialize(stream)
|
12
|
-
@stream = stream
|
13
|
-
@mutex = Mutex.new
|
14
|
-
end
|
15
|
-
|
16
11
|
protected
|
17
12
|
|
18
13
|
# @param [Message] message
|
data/lib/interop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil E. Pearson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby implementation of hx/interop cross-language interop abstraction
|
14
14
|
email:
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- lib/interop/rpc/dispatcher.rb
|
41
41
|
- lib/interop/rpc/magic.rb
|
42
42
|
- lib/interop/rpc/server.rb
|
43
|
+
- lib/interop/stream_adapter.rb
|
43
44
|
- lib/interop/stream_reader.rb
|
44
45
|
- lib/interop/stream_writer.rb
|
45
46
|
- lib/interop/version.rb
|