expect-pty 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -3
- data/README.md +102 -119
- data/docs/API.md +76 -51
- data/docs/MIGRATION.md +68 -15
- data/lib/expect/cleanup.rb +4 -3
- data/lib/expect/interaction.rb +57 -56
- data/lib/expect/logging.rb +60 -106
- data/lib/expect/matcher.rb +22 -19
- data/lib/expect/pattern.rb +2 -1
- data/lib/expect/pattern_list.rb +5 -5
- data/lib/expect/redactor.rb +1 -1
- data/lib/expect/relay.rb +20 -19
- data/lib/expect/relay_writer.rb +5 -4
- data/lib/expect/result.rb +1 -1
- data/lib/expect/session.rb +114 -68
- data/lib/expect/session_resources.rb +10 -17
- data/lib/expect/version.rb +2 -2
- data/lib/expect.rb +47 -370
- data/sig/expect.rbs +203 -279
- metadata +4 -20
- data/lib/expect/configuration.rb +0 -143
- data/lib/expect/terminal.rb +0 -102
data/sig/expect.rbs
CHANGED
|
@@ -1,32 +1,19 @@
|
|
|
1
|
-
# Public
|
|
2
|
-
|
|
1
|
+
# Public Session API; internal matching and relay protocols are documented with @api private.
|
|
2
|
+
module Expect
|
|
3
3
|
type duration = Numeric | String
|
|
4
4
|
type pattern = String | Regexp | :eof | :timeout
|
|
5
5
|
type result_error = :eof | :timeout | Exception | nil
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
type event = { event: Symbol, level: Symbol, pid: Integer?, fd: Integer?, message: String }
|
|
9
|
-
type diagnostic_target = _Writer | _Logger | _DiagnosticCallback
|
|
10
|
-
|
|
11
|
-
interface _LogCallback
|
|
12
|
-
def call: (String) -> untyped
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
interface _DiagnosticCallback
|
|
16
|
-
def call: (event) -> untyped
|
|
17
|
-
end
|
|
6
|
+
type result_fields = { number: Integer?, error: result_error, match: String?, before: String?, after: String?, session: Session?, captures: Array[String?] }
|
|
7
|
+
type diagnostic_event = { event: Symbol, pid: Integer?, fd: Integer?, message: String }
|
|
18
8
|
|
|
19
9
|
interface _Writer
|
|
20
10
|
def write: (String) -> Integer
|
|
21
11
|
end
|
|
22
12
|
|
|
23
|
-
interface _Path
|
|
24
|
-
def to_path: () -> String
|
|
25
|
-
end
|
|
26
|
-
|
|
27
13
|
interface _Logger
|
|
28
|
-
def
|
|
29
|
-
|
|
14
|
+
def add: (Integer, diagnostic_event, String) -> untyped
|
|
15
|
+
|
|
16
|
+
def debug?: () -> bool
|
|
30
17
|
end
|
|
31
18
|
|
|
32
19
|
VERSION: String
|
|
@@ -35,321 +22,258 @@ class Expect
|
|
|
35
22
|
|
|
36
23
|
class SpawnError < StandardError
|
|
37
24
|
end
|
|
25
|
+
|
|
38
26
|
class ReentrancyError < StandardError
|
|
39
27
|
end
|
|
28
|
+
|
|
40
29
|
class WriteTimeout < IOError
|
|
41
30
|
attr_reader bytes_written: Integer
|
|
31
|
+
|
|
42
32
|
def initialize: (?String message, ?bytes_written: Integer) -> void
|
|
43
33
|
end
|
|
44
34
|
|
|
45
|
-
def initialize: (
|
|
46
|
-
*String command,
|
|
47
|
-
?env: Hash[String, String?],
|
|
48
|
-
?chdir: String?,
|
|
49
|
-
?diagnostic_output: diagnostic_target?,
|
|
50
|
-
?timeout: duration?,
|
|
51
|
-
?write_timeout: duration?,
|
|
52
|
-
?buffer_limit: Integer?,
|
|
53
|
-
?debug_level: Integer,
|
|
54
|
-
?raw_pty: untyped,
|
|
55
|
-
?preserve_buffer: untyped,
|
|
56
|
-
?log_stdout: untyped,
|
|
57
|
-
?log_listeners: untyped,
|
|
58
|
-
?raw_terminal: untyped,
|
|
59
|
-
?reset_timeout_on_read: untyped,
|
|
60
|
-
?graceful_close: untyped
|
|
61
|
-
) -> void
|
|
62
35
|
def self.spawn: (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
?log_stdout: untyped,
|
|
74
|
-
?log_listeners: untyped,
|
|
75
|
-
?raw_terminal: untyped,
|
|
76
|
-
?reset_timeout_on_read: untyped,
|
|
77
|
-
?graceful_close: untyped
|
|
78
|
-
) -> Expect
|
|
79
|
-
| [A] (
|
|
80
|
-
*String command,
|
|
81
|
-
?env: Hash[String, String?],
|
|
82
|
-
?chdir: String?,
|
|
83
|
-
?diagnostic_output: diagnostic_target?,
|
|
84
|
-
?timeout: duration?,
|
|
85
|
-
?write_timeout: duration?,
|
|
86
|
-
?buffer_limit: Integer?,
|
|
87
|
-
?debug_level: Integer,
|
|
88
|
-
?raw_pty: untyped,
|
|
89
|
-
?preserve_buffer: untyped,
|
|
90
|
-
?log_stdout: untyped,
|
|
91
|
-
?log_listeners: untyped,
|
|
92
|
-
?raw_terminal: untyped,
|
|
93
|
-
?reset_timeout_on_read: untyped,
|
|
94
|
-
?graceful_close: untyped
|
|
95
|
-
) { (Expect) -> A } -> A
|
|
36
|
+
*String command, ?env: Hash[String, String?], ?chdir: String?, ?raw: bool, ?graceful: bool,
|
|
37
|
+
?timeout: duration?, ?write_timeout: duration?, ?buffer_limit: Integer?,
|
|
38
|
+
?logger: _Logger?, ?transcript: _Writer?, ?outputs: Array[_Writer]
|
|
39
|
+
) -> Session
|
|
40
|
+
| [A] (
|
|
41
|
+
*String command, ?env: Hash[String, String?], ?chdir: String?, ?raw: bool, ?graceful: bool,
|
|
42
|
+
?timeout: duration?, ?write_timeout: duration?, ?buffer_limit: Integer?,
|
|
43
|
+
?logger: _Logger?, ?transcript: _Writer?, ?outputs: Array[_Writer]
|
|
44
|
+
) { (Session) -> A } -> A
|
|
45
|
+
|
|
96
46
|
def self.open: (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
?log_stdout: untyped,
|
|
108
|
-
?log_listeners: untyped,
|
|
109
|
-
?raw_terminal: untyped,
|
|
110
|
-
?reset_timeout_on_read: untyped,
|
|
111
|
-
?graceful_close: untyped
|
|
112
|
-
) -> Expect
|
|
113
|
-
| [A] (
|
|
114
|
-
IO io,
|
|
115
|
-
?writer: IO,
|
|
116
|
-
?own: bool,
|
|
117
|
-
?diagnostic_output: diagnostic_target?,
|
|
118
|
-
?timeout: duration?,
|
|
119
|
-
?write_timeout: duration?,
|
|
120
|
-
?buffer_limit: Integer?,
|
|
121
|
-
?debug_level: Integer,
|
|
122
|
-
?raw_pty: untyped,
|
|
123
|
-
?preserve_buffer: untyped,
|
|
124
|
-
?log_stdout: untyped,
|
|
125
|
-
?log_listeners: untyped,
|
|
126
|
-
?raw_terminal: untyped,
|
|
127
|
-
?reset_timeout_on_read: untyped,
|
|
128
|
-
?graceful_close: untyped
|
|
129
|
-
) { (Expect) -> A } -> A
|
|
130
|
-
def self.configure: (
|
|
131
|
-
?timeout: duration?,
|
|
132
|
-
?write_timeout: duration?,
|
|
133
|
-
?buffer_limit: Integer?,
|
|
134
|
-
?debug_level: Integer,
|
|
135
|
-
?raw_pty: untyped,
|
|
136
|
-
?preserve_buffer: untyped,
|
|
137
|
-
?log_stdout: untyped,
|
|
138
|
-
?log_listeners: untyped,
|
|
139
|
-
?raw_terminal: untyped,
|
|
140
|
-
?reset_timeout_on_read: untyped,
|
|
141
|
-
?graceful_close: untyped
|
|
142
|
-
) ?{ (Configuration) -> untyped } -> Configuration
|
|
143
|
-
def self.configuration: () -> Configuration
|
|
47
|
+
IO io, ?writer: IO, ?own: bool, ?graceful: bool,
|
|
48
|
+
?timeout: duration?, ?write_timeout: duration?, ?buffer_limit: Integer?,
|
|
49
|
+
?logger: _Logger?, ?transcript: _Writer?, ?outputs: Array[_Writer]
|
|
50
|
+
) -> Session
|
|
51
|
+
| [A] (
|
|
52
|
+
IO io, ?writer: IO, ?own: bool, ?graceful: bool,
|
|
53
|
+
?timeout: duration?, ?write_timeout: duration?, ?buffer_limit: Integer?,
|
|
54
|
+
?logger: _Logger?, ?transcript: _Writer?, ?outputs: Array[_Writer]
|
|
55
|
+
) { (Session) -> A } -> A
|
|
56
|
+
|
|
144
57
|
def self.continue: (?reset_timeout: bool) -> (:continue | :continue_without_reset)
|
|
58
|
+
|
|
145
59
|
def self.monotonic: () -> Float
|
|
60
|
+
|
|
146
61
|
def self.duration: (duration?) -> Float?
|
|
147
|
-
|
|
148
|
-
def self.
|
|
62
|
+
|
|
63
|
+
def self.readable_sessions: (*Session sessions, ?timeout: duration?) -> Array[Session]
|
|
64
|
+
|
|
65
|
+
def self.interconnect: (*Session sessions, ?timeout: duration?) -> Session?
|
|
66
|
+
|
|
149
67
|
def self.expect: (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
?
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
def expect: (*pattern patterns, ?timeout: duration?, ?deadline: duration?) ?{ (PatternList) -> untyped } -> Result
|
|
156
|
-
def continue: (?reset_timeout: bool) -> (:continue | :continue_without_reset)
|
|
157
|
-
def after: () -> String?
|
|
158
|
-
def before: () -> String?
|
|
159
|
-
def match: () -> String?
|
|
160
|
-
def alive?: () -> bool
|
|
161
|
-
def closed?: () -> bool
|
|
162
|
-
def eof?: () -> bool
|
|
163
|
-
def tty?: () -> bool
|
|
164
|
-
def pending_output?: () -> bool
|
|
165
|
-
def buffer: () -> String
|
|
166
|
-
def clear_buffer: () -> String
|
|
167
|
-
def buffer_discarded_bytes: () -> Integer
|
|
168
|
-
def captures: () -> Array[String?]
|
|
169
|
-
def command: () -> Array[String]?
|
|
170
|
-
def diagnostic_output: () -> diagnostic_target?
|
|
171
|
-
def error: () -> result_error
|
|
172
|
-
def exit_code: () -> Integer?
|
|
173
|
-
def fileno: () -> Integer?
|
|
174
|
-
def pid: () -> Integer?
|
|
175
|
-
def match_number: () -> Integer?
|
|
176
|
-
def last_result: () -> Result?
|
|
177
|
-
def listeners: () -> Array[_Writer]
|
|
178
|
-
def log_output: () -> log_target?
|
|
179
|
-
def slave: () -> IO?
|
|
180
|
-
def tty_name: () -> String?
|
|
181
|
-
def to_io: () -> IO
|
|
182
|
-
def writer: () -> IO
|
|
183
|
-
def process_status: () -> Process::Status?
|
|
184
|
-
def winsize: () -> [Integer, Integer]
|
|
185
|
-
def inspect: () -> String
|
|
186
|
-
def close: (?graceful: bool) -> nil
|
|
187
|
-
def soft_close: (?timeout: duration?, ?term_timeout: duration) -> Process::Status?
|
|
188
|
-
def hard_close: (?timeout: duration) -> Process::Status?
|
|
189
|
-
def wait: (?timeout: duration?) -> Process::Status?
|
|
190
|
-
def write: (*untyped objects) -> Integer
|
|
191
|
-
def send_slow: (*untyped objects, delay: duration) -> Integer
|
|
192
|
-
def puts: (*untyped objects) -> nil
|
|
193
|
-
def <<: (untyped object) -> Expect
|
|
194
|
-
def spawn: (*String command, ?env: Hash[String, String?], ?chdir: String?) -> Expect
|
|
195
|
-
def on_sequence: ((String | Regexp | :eof) sequence) ?{ () -> untyped } -> Expect
|
|
196
|
-
def redact: (*String secrets) -> Expect
|
|
197
|
-
def interact: (?input: (IO | Expect), ?escape: (String | Regexp)?, ?output: _Writer?, ?timeout: duration?) -> Expect?
|
|
198
|
-
def stty: (*String modes) -> String
|
|
199
|
-
def log_to: (?(log_target | String | _Path) target, ?mode: String) ?{ (String) -> untyped } -> log_target
|
|
200
|
-
def write_log: (*untyped objects) -> untyped
|
|
201
|
-
def timeout: () -> Float?
|
|
202
|
-
def timeout=: (duration? value) -> void
|
|
203
|
-
def write_timeout: () -> Float?
|
|
204
|
-
def write_timeout=: (duration? value) -> void
|
|
205
|
-
def buffer_limit: () -> Integer?
|
|
206
|
-
def buffer_limit=: (Integer? value) -> void
|
|
207
|
-
def debug_level: () -> Integer
|
|
208
|
-
def debug_level=: (Integer value) -> void
|
|
209
|
-
|
|
210
|
-
def raw_pty=: (untyped value) -> void
|
|
211
|
-
def raw_pty?: () -> bool
|
|
212
|
-
|
|
213
|
-
def preserve_buffer=: (untyped value) -> void
|
|
214
|
-
def preserve_buffer?: () -> bool
|
|
215
|
-
|
|
216
|
-
def log_stdout=: (untyped value) -> void
|
|
217
|
-
def log_stdout?: () -> bool
|
|
218
|
-
|
|
219
|
-
def log_listeners=: (untyped value) -> void
|
|
220
|
-
def log_listeners?: () -> bool
|
|
221
|
-
|
|
222
|
-
def raw_terminal=: (untyped value) -> void
|
|
223
|
-
def raw_terminal?: () -> bool
|
|
224
|
-
|
|
225
|
-
def reset_timeout_on_read=: (untyped value) -> void
|
|
226
|
-
def reset_timeout_on_read?: () -> bool
|
|
227
|
-
|
|
228
|
-
def graceful_close=: (untyped value) -> void
|
|
229
|
-
def graceful_close?: () -> bool
|
|
230
|
-
def buffer=: (String value) -> void
|
|
231
|
-
def diagnostic_output=: (diagnostic_target? value) -> void
|
|
232
|
-
def log_output=: (log_target? value) -> void
|
|
233
|
-
def listeners=: (Array[_Writer] value) -> void
|
|
234
|
-
def winsize=: ([Integer, Integer] value) -> void
|
|
235
|
-
|
|
236
|
-
class Configuration
|
|
68
|
+
*pattern patterns, ?from: (Session | Array[Session]), ?timeout: duration?, ?deadline: duration?,
|
|
69
|
+
?consume: bool, ?reset_timeout_on_read: bool
|
|
70
|
+
) ?{ (PatternList) -> untyped } -> Result
|
|
71
|
+
|
|
72
|
+
class Session
|
|
237
73
|
def initialize: (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
?
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
74
|
+
?timeout: duration?, ?write_timeout: duration?, ?buffer_limit: Integer?,
|
|
75
|
+
?logger: _Logger?, ?transcript: _Writer?, ?outputs: Array[_Writer]
|
|
76
|
+
) -> void
|
|
77
|
+
|
|
78
|
+
def spawn: (*String command, ?env: Hash[String, String?], ?chdir: String?, ?raw: bool) -> Session
|
|
79
|
+
|
|
80
|
+
def expect: (
|
|
81
|
+
*pattern patterns, ?timeout: duration?, ?deadline: duration?, ?consume: bool, ?reset_timeout_on_read: bool
|
|
82
|
+
) ?{ (PatternList) -> untyped } -> Result
|
|
83
|
+
|
|
84
|
+
def after: () -> String?
|
|
85
|
+
|
|
86
|
+
def before: () -> String?
|
|
87
|
+
|
|
88
|
+
def match: () -> String?
|
|
89
|
+
|
|
90
|
+
def alive?: () -> bool
|
|
91
|
+
|
|
92
|
+
def closed?: () -> bool
|
|
93
|
+
|
|
94
|
+
def eof?: () -> bool
|
|
95
|
+
|
|
96
|
+
def tty?: () -> bool
|
|
97
|
+
|
|
98
|
+
def pending_output?: () -> bool
|
|
99
|
+
|
|
100
|
+
def buffer: () -> String
|
|
101
|
+
|
|
102
|
+
def buffer=: (String value) -> void
|
|
103
|
+
|
|
104
|
+
def clear_buffer: () -> String
|
|
105
|
+
|
|
106
|
+
def buffer_discarded_bytes: () -> Integer
|
|
107
|
+
|
|
108
|
+
def captures: () -> Array[String?]
|
|
109
|
+
|
|
110
|
+
def command: () -> Array[String]?
|
|
111
|
+
|
|
112
|
+
def error: () -> result_error
|
|
113
|
+
|
|
114
|
+
def exit_code: () -> Integer?
|
|
115
|
+
|
|
116
|
+
def fileno: () -> Integer?
|
|
117
|
+
|
|
118
|
+
def pid: () -> Integer?
|
|
119
|
+
|
|
120
|
+
def match_number: () -> Integer?
|
|
121
|
+
|
|
122
|
+
def last_result: () -> Result?
|
|
123
|
+
|
|
124
|
+
def slave: () -> IO?
|
|
125
|
+
|
|
126
|
+
def tty_name: () -> String?
|
|
127
|
+
|
|
128
|
+
def to_io: () -> IO
|
|
129
|
+
|
|
130
|
+
def writer: () -> IO
|
|
131
|
+
|
|
132
|
+
def process_status: () -> Process::Status?
|
|
133
|
+
|
|
134
|
+
def inspect: () -> String
|
|
135
|
+
|
|
136
|
+
def close: (?graceful: bool) -> nil
|
|
137
|
+
|
|
138
|
+
def soft_close: (?timeout: duration?, ?term_timeout: duration) -> Process::Status?
|
|
139
|
+
|
|
140
|
+
def hard_close: (?timeout: duration) -> Process::Status?
|
|
141
|
+
|
|
142
|
+
def wait: (?timeout: duration?) -> Process::Status?
|
|
143
|
+
|
|
144
|
+
def write: (*untyped objects) -> Integer
|
|
145
|
+
|
|
146
|
+
def send_slow: (*untyped objects, delay: duration) -> Integer
|
|
147
|
+
|
|
148
|
+
def puts: (*untyped objects) -> nil
|
|
149
|
+
|
|
150
|
+
def <<: (untyped object) -> Session
|
|
151
|
+
|
|
152
|
+
def on_sequence: ((String | Regexp | :eof) sequence) ?{ () -> untyped } -> Session
|
|
153
|
+
|
|
154
|
+
def redact: (*String secrets) -> Session
|
|
155
|
+
|
|
156
|
+
def interact: (?input: (IO | Session), ?escape: (String | Regexp)?, ?output: _Writer?, ?timeout: duration?, ?raw: bool) -> Session?
|
|
157
|
+
|
|
250
158
|
def timeout: () -> Float?
|
|
251
|
-
|
|
159
|
+
|
|
160
|
+
def timeout=: (duration? value) -> void
|
|
161
|
+
|
|
252
162
|
def write_timeout: () -> Float?
|
|
253
|
-
|
|
163
|
+
|
|
164
|
+
def write_timeout=: (duration? value) -> void
|
|
165
|
+
|
|
254
166
|
def buffer_limit: () -> Integer?
|
|
255
|
-
def buffer_limit=: (Integer?) -> Integer?
|
|
256
|
-
def debug_level: () -> Integer
|
|
257
|
-
def debug_level=: (Integer) -> Integer
|
|
258
167
|
|
|
259
|
-
def
|
|
260
|
-
|
|
168
|
+
def buffer_limit=: (Integer? value) -> void
|
|
169
|
+
|
|
170
|
+
def logger: () -> _Logger?
|
|
261
171
|
|
|
262
|
-
def
|
|
263
|
-
def preserve_buffer?: () -> bool
|
|
172
|
+
def logger=: (_Logger? value) -> void
|
|
264
173
|
|
|
265
|
-
def
|
|
266
|
-
def log_stdout?: () -> bool
|
|
174
|
+
def transcript: () -> _Writer?
|
|
267
175
|
|
|
268
|
-
def
|
|
269
|
-
def log_listeners?: () -> bool
|
|
176
|
+
def transcript=: (_Writer? value) -> void
|
|
270
177
|
|
|
271
|
-
def
|
|
272
|
-
def raw_terminal?: () -> bool
|
|
178
|
+
def outputs: () -> Array[_Writer]
|
|
273
179
|
|
|
274
|
-
def
|
|
275
|
-
def reset_timeout_on_read?: () -> bool
|
|
180
|
+
def outputs=: (Array[_Writer] value) -> void
|
|
276
181
|
|
|
277
|
-
def
|
|
278
|
-
def graceful_close?: () -> bool
|
|
279
|
-
def to_h: () -> Hash[Symbol, untyped]
|
|
182
|
+
def write_transcript: (*untyped objects) -> nil
|
|
280
183
|
end
|
|
281
184
|
|
|
282
185
|
class Result < Data
|
|
283
186
|
def self.new: (
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
187
|
+
?number: Integer?,
|
|
188
|
+
?error: result_error,
|
|
189
|
+
?match: String?,
|
|
190
|
+
?before: String?,
|
|
191
|
+
?after: String?,
|
|
192
|
+
?session: Session?,
|
|
193
|
+
?captures: Array[String?]
|
|
194
|
+
) -> Result
|
|
195
|
+
| (?Integer?, ?result_error, ?String?, ?String?, ?String?, ?Session?, ?Array[String?]) -> Result
|
|
196
|
+
|
|
293
197
|
def self.[]: (
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
198
|
+
?number: Integer?,
|
|
199
|
+
?error: result_error,
|
|
200
|
+
?match: String?,
|
|
201
|
+
?before: String?,
|
|
202
|
+
?after: String?,
|
|
203
|
+
?session: Session?,
|
|
204
|
+
?captures: Array[String?]
|
|
205
|
+
) -> Result
|
|
206
|
+
| (?Integer?, ?result_error, ?String?, ?String?, ?String?, ?Session?, ?Array[String?]) -> Result
|
|
207
|
+
|
|
303
208
|
def self.members: () -> Array[Symbol]
|
|
209
|
+
|
|
304
210
|
def self.inspect: () -> String
|
|
211
|
+
|
|
305
212
|
def members: () -> Array[Symbol]
|
|
213
|
+
|
|
306
214
|
attr_reader number: Integer?
|
|
307
215
|
attr_reader error: result_error
|
|
308
216
|
attr_reader match: String?
|
|
309
217
|
attr_reader before: String?
|
|
310
218
|
attr_reader after: String?
|
|
311
|
-
attr_reader session:
|
|
219
|
+
attr_reader session: Session?
|
|
312
220
|
attr_reader captures: Array[String?]
|
|
221
|
+
|
|
313
222
|
def initialize: (
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
223
|
+
?number: Integer?,
|
|
224
|
+
?error: result_error,
|
|
225
|
+
?match: String?,
|
|
226
|
+
?before: String?,
|
|
227
|
+
?after: String?,
|
|
228
|
+
?session: Session?,
|
|
229
|
+
?captures: Array[String?]
|
|
230
|
+
) -> void
|
|
231
|
+
|
|
322
232
|
def matched?: () -> bool
|
|
233
|
+
|
|
323
234
|
def timeout?: () -> bool
|
|
235
|
+
|
|
324
236
|
def eof?: () -> bool
|
|
325
|
-
|
|
237
|
+
|
|
238
|
+
def deconstruct: () -> [Integer?, result_error, String?, String?, String?, Session?, Array[String?]]
|
|
239
|
+
|
|
326
240
|
def with: (
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
241
|
+
?number: Integer?,
|
|
242
|
+
?error: result_error,
|
|
243
|
+
?match: String?,
|
|
244
|
+
?before: String?,
|
|
245
|
+
?after: String?,
|
|
246
|
+
?session: Session?,
|
|
247
|
+
?captures: Array[String?]
|
|
248
|
+
) -> Result
|
|
249
|
+
|
|
335
250
|
def to_h: () -> result_fields
|
|
336
|
-
|
|
251
|
+
| [K, V] () { (Symbol, untyped) -> [K, V] } -> Hash[K, V]
|
|
252
|
+
|
|
337
253
|
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, untyped]
|
|
338
254
|
end
|
|
339
255
|
|
|
340
256
|
class PatternList
|
|
341
|
-
def initialize: (?(
|
|
342
|
-
|
|
343
|
-
def
|
|
344
|
-
|
|
257
|
+
def initialize: (?(Session | Array[Session]) sessions, ?Array[pattern] patterns) -> void
|
|
258
|
+
|
|
259
|
+
def on: ((String | Regexp) value, ?from: (Session | Array[Session])) ?{ (Session) -> untyped } -> PatternList
|
|
260
|
+
|
|
261
|
+
def eof: (?from: (Session | Array[Session])) ?{ (Session) -> untyped } -> PatternList
|
|
262
|
+
|
|
263
|
+
def timeout: () ?{ (Array[Session]) -> untyped } -> PatternList
|
|
345
264
|
end
|
|
346
265
|
|
|
347
266
|
class Redactor
|
|
348
267
|
def self.redact: (String data, Array[String] patterns, ?replacement: String) -> String
|
|
268
|
+
|
|
349
269
|
def initialize: (Array[String] patterns, ?replacement: String) -> void
|
|
270
|
+
|
|
350
271
|
def patterns=: (Array[String]) -> void
|
|
272
|
+
|
|
351
273
|
def append: (String) -> String
|
|
274
|
+
|
|
352
275
|
def finish: (?partial: bool) -> String
|
|
276
|
+
|
|
353
277
|
def inspect: () -> String
|
|
354
278
|
end
|
|
355
279
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: expect-pty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- expect-pty contributors
|
|
@@ -9,20 +9,6 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 2026-10-01 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: forwardable
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - ">="
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '1.3'
|
|
19
|
-
type: :runtime
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - ">="
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '1.3'
|
|
26
12
|
- !ruby/object:Gem::Dependency
|
|
27
13
|
name: io-console
|
|
28
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -38,19 +24,19 @@ dependencies:
|
|
|
38
24
|
- !ruby/object:Gem::Version
|
|
39
25
|
version: '0.6'
|
|
40
26
|
- !ruby/object:Gem::Dependency
|
|
41
|
-
name:
|
|
27
|
+
name: logger
|
|
42
28
|
requirement: !ruby/object:Gem::Requirement
|
|
43
29
|
requirements:
|
|
44
30
|
- - ">="
|
|
45
31
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
32
|
+
version: '1.6'
|
|
47
33
|
type: :runtime
|
|
48
34
|
prerelease: false
|
|
49
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
36
|
requirements:
|
|
51
37
|
- - ">="
|
|
52
38
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
39
|
+
version: '1.6'
|
|
54
40
|
- !ruby/object:Gem::Dependency
|
|
55
41
|
name: stringio
|
|
56
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -78,7 +64,6 @@ files:
|
|
|
78
64
|
- docs/MIGRATION.md
|
|
79
65
|
- lib/expect.rb
|
|
80
66
|
- lib/expect/cleanup.rb
|
|
81
|
-
- lib/expect/configuration.rb
|
|
82
67
|
- lib/expect/interaction.rb
|
|
83
68
|
- lib/expect/logging.rb
|
|
84
69
|
- lib/expect/matcher.rb
|
|
@@ -91,7 +76,6 @@ files:
|
|
|
91
76
|
- lib/expect/result.rb
|
|
92
77
|
- lib/expect/session.rb
|
|
93
78
|
- lib/expect/session_resources.rb
|
|
94
|
-
- lib/expect/terminal.rb
|
|
95
79
|
- lib/expect/version.rb
|
|
96
80
|
- sig/expect.rbs
|
|
97
81
|
homepage: https://github.com/gatework/expect-ruby
|